Does CHS parameter affect disk performance?

This is for discussing general topics about how to use VirtualBox.
Post Reply
infoagee
Posts: 4
Joined: 14. Oct 2021, 02:54

Does CHS parameter affect disk performance?

Post by infoagee »

Hi all,
I use VirtualBox 5.0 yet, and found vdi always shows PCHS=?/16/63 and LCHS=?/64/63.
Because I usually create a vdi with size as a round number, such as 100MB, not 100.1MB,
I quite prefer CHS parameters like ?/128/32, which is set by fdisk.
So I wonder if parameters such as ?/128/32 will affect performance or not.
Note that Linux often use ?/255/63 for disks.
Is it best to set CHS to ?/16/63 or ?/64/63?
Any idea?
scottgus1
Site Moderator
Posts: 20965
Joined: 30. Dec 2009, 20:14
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Windows, Linux

Re: Does CHS parameter affect disk performance?

Post by scottgus1 »

I have been unsuccessful finding a Virtualbox command to edit these settings. What command are you using?

FWIW I have never edited these settings even in a real PC and have not had issues.
infoagee
Posts: 4
Joined: 14. Oct 2021, 02:54

Re: Does CHS parameter affect disk performance?

Post by infoagee »

scottgus1 wrote:I have been unsuccessful finding a Virtualbox command to edit these settings. What command are you using?

FWIW I have never edited these settings even in a real PC and have not had issues.
I can not modify PCHS/LCHS either.
I use fdisk in Linux guest to modify CHS, and this new CHS is recognized only by Linux guest.
While the PCHS/LCHS in VBox.log remains unchanged.
infoagee
Posts: 4
Joined: 14. Oct 2021, 02:54

Re: Does CHS parameter affect disk performance?

Post by infoagee »

scottgus1 wrote:I have been unsuccessful finding a Virtualbox command to edit these settings. What command are you using?

FWIW I have never edited these settings even in a real PC and have not had issues.
ok, I find there exists the vbox-img.exe in VirtualBox 5.0 installation folder on Windows Host.
ref /viewtopic.php?t=97511 in this forum (sorry, I can not post link yet).
mpack
Site Moderator
Posts: 39156
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Mostly XP

Re: Does CHS parameter affect disk performance?

Post by mpack »

It is my understanding that CHS parameters are irrelevant in any guest using a drive larger than 8GB. All modern drives use linear (LBA) addresses exclusively, and use internal electronics to map LBA onto a location on the drive. All partitions created using fdisk will have both CHS and LBA addresses, but the CHS will be maxed out and ignored.

And of course the notion of cylinders and heads has always been completely irrelevant to an SSD, which has neither. Also I believe that SCSI and all related protocols (SATA, USB mass storage) all use LBA addressing exclusively, so this discussion only ever affected IDE drives.

And in answer to the question: on drives where CHS is still relevant, changing CHS will simply stop the disk from working, because you essentially shuffled the order of the sectors. Even if you created a new disk with the shuffled order I do not believe it would perform better. Why would it? It's not like you can match the host geometry.

p.s. I don't really know how fdisk on Linux differs from fdisk of old, but fdisk of old stores the C,H,S parameters in 10bits, 8bits and 6bits respectively. Some of these maxed out in the '80s, so they stopped having any physical meaning quite early on. When you max out all the numbers you get the 8GB max capacity already mentioned, assuming 512byte sectors. Luckily there was room in the MBR to store a 32bit LBA - and that leads to the 2TB MBR limit. A VDI with maxed out CHS will show numbers 1023.254.63 I think, though common notation uses 1-based numbering for some of these, so you have to be careful to compare like with like.
infoagee
Posts: 4
Joined: 14. Oct 2021, 02:54

Re: Does CHS parameter affect disk performance?

Post by infoagee »

@mpack
Thanks for detail explanations.
So, if a guest OS was installed successfully and runs well, then, no matter what VirtualBox's version is, and no matter how old the guest OS is, the guest OS must be using LBA internally in fact, and the disk drive provided to the guest by VirtualBox uses LBA too? Then there's no business with CHS at all?
mpack
Site Moderator
Posts: 39156
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Mostly XP

Re: Does CHS parameter affect disk performance?

Post by mpack »

infoagee wrote:and the disk drive provided to the guest by VirtualBox uses LBA too? Then there's no business with CHS at all?
I'm not sure I understand that one. VirtualBox doesn't provide disk drives to the guest, it simulates drives using files on the host, and those will be accessed using normal host file seek and read/write calls. So naturally all disk addresses ultimately get turned into file offsets. Simulated CHS address translations never have anything to do with actual host drive geometry.
Post Reply