[parted-devel] Using parted to create a loopback disk with cylinders of a non-default size.

Brian C. Lane bcl at redhat.com
Mon Oct 11 18:01:02 UTC 2010


On Mon, Oct 11, 2010 at 12:02:22PM -0500, Mills, James wrote:
> 
> Replying to my own post, I have a bit more information around this
> behavior.  Hopefully it will help someone on the list point me in the
> right direction.
> 
> I have 4 machines:
> 
> Ubuntu 9.10 x86 running parted 1.8.8.1.159-1e0e
> Ubuntu 10.04 amd64 running parted 2.2
> Ubuntu 10.04 x86 running parted 2.2
> Fedora Core 13 x86 running parted 1.9

The Fedora version should be v2.1

> 
> On all four boxes, I am using the following steps (as root)
> 
> losetup -d /dev/loop1
> dd if=/dev/zero of=test bs=1M count=100
> losetup /dev/loop1 test
> parted  -s /dev/loop1 mklabel msdos
> 
> At this point, I run both "fdisk -l /dev/loop1" and "parted /dev/loop1
> -s unit chs p"
> 
> Version 1.8.8 reports the same CHS numbers using both fdisk and parted
> (12,255,63). All other versions report:
> 
> fdisk - 12,255,63
> parted - 1600,4,32
> 
> Can anyone help me understand what has changed that would cause me to
> get such disparate behavior?

When using a file or loop device the heads and sectors are set to 4,32
and cylinders is set based on the length using these defaults.

See init_file() in libparted/arch/linux.c

As for why this is different, I have no idea. When dealing with real
devices it appears to set it to 255,63 as a default, unless the kernel
returns useful info with HDIO_GETGEO ioctl call (which according to the
comments isn't useful with 2.6.x kernels).

See _device_probe_geometry() in libparted/arch/linux.c

Does C,H,S really matter for any real usage, or is this just cosmetic?

-- 
Brian C. Lane / Anaconda Team
Port Orchard, WA (PST8PDT)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 517 bytes
Desc: not available
URL: <http://lists.alioth.debian.org/pipermail/parted-devel/attachments/20101011/3de5c743/attachment.pgp>


More information about the parted-devel mailing list