Loop device with 4K sectors

loop-device

Using the losetup command, you can turn a regular file into a pretend block device. You can then partition and format it like any other device.

Is there some way to make Linux pretend that this "device" has a 4K logical sector size?

Best Answer

fdisk has a number of switches:

-b sectorsize

Specify the sector size of the disk. Valid values are 512, 1024, 2048 or 4096. (Recent kernels know the sector size. Use this only on old kernels or to override the kernel's ideas.) Since util- linux-2.17, fdisk differentiates between logical and physical sector size. This option changes both sector sizes to sectorsize.

-C cyls

Specify the number of cylinders of the disk. I have no idea why anybody would want to do so.

-H heads

Specify the number of heads of the disk. (Not the physical number, of course, but the number used for partition tables.) Reasonable values are 255 and 16.

That's not me editorializing ("I have no idea why anybody would want to do so."). Kind of nice someone included functionality they didn't see a use for at the time.

Related Question