Util-Linux package development
 help / color / mirror / Atom feed
* sfdisk: trying to create aligned partitions: fail
@ 2011-08-17  6:13 Giulio
  2011-08-17  7:56 ` Karel Zak
  0 siblings, 1 reply; 5+ messages in thread
From: Giulio @ 2011-08-17  6:13 UTC (permalink / raw)
  To: util-linux

Linux 2.6.18-238.12.1.el5
sfdisk from util-linux 2.20-rc1
fdisk (util-linux 2.20-rc1)
200GB VMware SCSI disk

It seems it's not immediately possible to create aligned partitions (ie:
starting at 1MB/2048 sectors) with sfdisk.

1) 1st try, using MBs as unit of measure:

dd if=/dev/zero of=/dev/sda bs=1 count=512
sfdisk -L -uM /dev/sda <<-EOF
1,1001,83
,,83
;
;
EOF

Results (starts at sector 1 instead of 1MB):
$ fdisk -lu /dev/sda
 
Disk /dev/sda: 214.7 GB, 214748364800 bytes
255 heads, 63 sectors/track, 26108 cylinders, total 419430400 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000
 
   Device Boot      Start         End      Blocks   Id  System
/dev/sda1               1     2056319     1028159+  83  Linux
/dev/sda2         2056320   419425019   208684350   83  Linux


2) 2nd try, using sectors as unit of measure:

dd if=/dev/zero of=/dev/sda bs=1 count=512
sfdisk -L -uS /dev/sda <<-EOF
2048,2050048,83
,,83
;
;
EOF

Results (wrong 2nd partition created):
$ fdisk -lu /dev/sda
 
Disk /dev/sda: 214.7 GB, 214748364800 bytes
255 heads, 63 sectors/track, 26108 cylinders, total 419430400 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000
 
   Device Boot      Start         End      Blocks   Id  System
/dev/sda1            2048     2052095     1025024   83  Linux
/dev/sda2               1        2047        1023+  83  Linux
/dev/sda3         2052096   419430399   208689152   83  Linux
 
Partition table entries are not in disk order


===

Is there some option to enable alignment?

Thanks

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: sfdisk: trying to create aligned partitions: fail
  2011-08-17  6:13 sfdisk: trying to create aligned partitions: fail Giulio
@ 2011-08-17  7:56 ` Karel Zak
  2011-08-17  9:31   ` Giulio
  0 siblings, 1 reply; 5+ messages in thread
From: Karel Zak @ 2011-08-17  7:56 UTC (permalink / raw)
  To: giulioo; +Cc: util-linux

On Wed, Aug 17, 2011 at 08:13:06AM +0200, Giulio wrote:
> Linux 2.6.18-238.12.1.el5
> sfdisk from util-linux 2.20-rc1
> fdisk (util-linux 2.20-rc1)
> 200GB VMware SCSI disk
> 
> It seems it's not immediately possible to create aligned partitions (ie:
> starting at 1MB/2048 sectors) with sfdisk.

 This is unsupported by sfdisk and cfdisk. You have to use fdisk or
 parted.

 I'll add a note about it to the man page...

    Karel

-- 
 Karel Zak  <kzak@redhat.com>
 http://karelzak.blogspot.com

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: sfdisk: trying to create aligned partitions: fail
  2011-08-17  7:56 ` Karel Zak
@ 2011-08-17  9:31   ` Giulio
  2011-08-17 12:44     ` Karel Zak
  0 siblings, 1 reply; 5+ messages in thread
From: Giulio @ 2011-08-17  9:31 UTC (permalink / raw)
  To: Karel Zak; +Cc: util-linux

On Wed, 17 Aug 2011 09:56:13 +0200, Karel Zak <kzak@redhat.com> wrote:

>On Wed, Aug 17, 2011 at 08:13:06AM +0200, Giulio wrote:
>> Linux 2.6.18-238.12.1.el5
>> sfdisk from util-linux 2.20-rc1
>> fdisk (util-linux 2.20-rc1)
>> 200GB VMware SCSI disk
>> 
>> It seems it's not immediately possible to create aligned partitions (ie:
>> starting at 1MB/2048 sectors) with sfdisk.
>
> This is unsupported by sfdisk and cfdisk. You have to use fdisk or
> parted.

What is unsupported?

I know sfdisk won't automatically align partitions and didn't expect it to
do it, my email was about sfdisk behaving in an unexpected way:
- not respecting 1MB as start of partition when I ask for it
- creating partitions out of order when using sectors

Maybe I chose the wrong subject, I was trying to align partition manually
and sfidk won't let me do it.

Thanks.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: sfdisk: trying to create aligned partitions: fail
  2011-08-17  9:31   ` Giulio
@ 2011-08-17 12:44     ` Karel Zak
  2011-08-17 13:46       ` Giulio Orsero
  0 siblings, 1 reply; 5+ messages in thread
From: Karel Zak @ 2011-08-17 12:44 UTC (permalink / raw)
  To: giulioo; +Cc: util-linux

On Wed, Aug 17, 2011 at 11:31:56AM +0200, Giulio wrote:
> I know sfdisk won't automatically align partitions and didn't expect it to
> do it, my email was about sfdisk behaving in an unexpected way:
> - not respecting 1MB as start of partition when I ask for it
> - creating partitions out of order when using sectors

 Try --in-order command line option, the option is undocumented in old
 versions ;-(

 sfdisk --in-order -L -uM /dev/sdb <<-EOF
 1,10,83
 ,,83
 ;
 ;
 EOF

 result (output from fdisk):
       Device Boot      Start         End      Blocks   Id  System
    /dev/sdb1            2048       22527       10240   83  Linux
    /dev/sdb2           22528      204799       91136   83  Linux



sfdisk --in-order -L -uS /dev/sdb <<-EOF
2048,8000,83
,,83
;
;
EOF

 result (output from fdisk):

       Device Boot      Start         End      Blocks   Id  System
    /dev/sdb1            2048       10047        4000   83  Linux
    /dev/sdb2           10048      204799       97376   83  Linux



-- 
 Karel Zak  <kzak@redhat.com>
 http://karelzak.blogspot.com

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: sfdisk: trying to create aligned partitions: fail
  2011-08-17 12:44     ` Karel Zak
@ 2011-08-17 13:46       ` Giulio Orsero
  0 siblings, 0 replies; 5+ messages in thread
From: Giulio Orsero @ 2011-08-17 13:46 UTC (permalink / raw)
  To: Karel Zak; +Cc: util-linux

On Wed, Aug 17, 2011 at 14:44, Karel Zak <kzak@redhat.com> wrote:
> On Wed, Aug 17, 2011 at 11:31:56AM +0200, Giulio wrote:
>> I know sfdisk won't automatically align partitions and didn't expect it =
to
>> do it, my email was about sfdisk behaving in an unexpected way:
>> - not respecting 1MB as start of partition when I ask for it
>> - creating partitions out of order when using sectors
>
> =C2=A0Try --in-order command line option, the option is undocumented in o=
ld
> =C2=A0versions ;-(

With "--in-order" the issue with partitions out of order (the case in
which I was using -uS) is solved.

However, there still is an isse when using -uM
I was trying with a 200GB VMware disk and when I used -uM and 1 as
start of 1st partition sfdisk would create a partition starting at
sector 1 (not MB 1).

I see you used a 100MB disk, so I tried different sizes until I found
when the error appears, unfortunately I'm not able to fine grain sizes
in VMware more than the following:

=3D=3D command used
DEV=3D$1
dd if=3D/dev/zero of=3D/dev/$DEV bs=3D1 count=3D512
sfdisk --in-order -L -uM /dev/$DEV <<-EOF
1,10,83
,,83
;
;
EOF
=3D=3D

=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D with a  1062MB, OK:
Disk /dev/sdc: 1062 MB, 1062207488 bytes
64 heads, 32 sectors/track, 1013 cylinders, total 2074624 sectors
Units =3D sectors of 1 * 512 =3D 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

   Device Boot      Start         End      Blocks   Id  System
/dev/sdc1            2048       22527       10240   83  Linux
<=3D=3D=3D=3D start sector 2048
/dev/sdc2           22528     2074623     1026048   83  Linux
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D

=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D with a  1073MB, NOT-OK:
Disk /dev/sdb: 1073 MB, 1073741824 bytes
255 heads, 63 sectors/track, 130 cylinders, total 2097152 sectors
Units =3D sectors of 1 * 512 =3D 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1               1       32129       16064+  83  Linux
<=3D=3D=3D=3D=3D start sector 1
/dev/sdb2           32130     2088449     1028160   83  Linux
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D

Thanks

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2011-08-17 13:46 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-08-17  6:13 sfdisk: trying to create aligned partitions: fail Giulio
2011-08-17  7:56 ` Karel Zak
2011-08-17  9:31   ` Giulio
2011-08-17 12:44     ` Karel Zak
2011-08-17 13:46       ` Giulio Orsero

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox