Re: sfdisk and 1MiB post-MBR gap

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 2010-08-10, at 3:01 AM, Karel Zak wrote:

> On Mon, Aug 09, 2010 at 09:00:35PM -0400, Eric Thibodeau wrote:
>> As per ftp://ftp.kernel.org/pub/linux/utils/util-linux-ng/v2.18/v2.18-ReleaseNotes :
>> 
>> fdisk(8):
>>  - supports new command line option "-c" to switch off DOS mode
>>  - uses 1MiB offset for the first partition
>>    (all these changes are already in the release 2.17.2)
>> 
>> I presume the 1MiB offset is to accomodate for grub2. 
> 
> No, the offset (and alignment to MiBs) is there for compatibility and
> portability (raids, 4K sector disks, win7, ...).

OK, I was biased in that train of thoughts. Nonetheless, this offset would probably make life easier for anyone (like me) wanting to use sfdisk + grub2, which requires a larger post-MBR gap than in the past. Could it also be added to sfdisk as an option?

>> My attempts in partitioning a drive with a 1MiB post-MBR gap failed
> 
> sfdisk has tendency to use CHS to calculate partition size, it means
> that 1MiB does not have to be on cylinder boundary. You have to use
> sectors as basic units.
> 
> The another problem is that it checks against cylinder boundary, so
> you need to use --force ...
> 
>> with the following command line call:
>> 
>> sfdisk -uM -L /dev/sda <<-EOF
> 
> try to use -uS, it seems that sfdisk rounds to cylinders if magabyte
> is specified (this should be fixed).
> 
>> 1,256,fd
>> ,512,fd
>> ,,fd
>> ;
>> EOF
> 
> for example:
> 
>   sfdisk --force -uS /dev/sdb <<EOF
>   2048 102400 0x83
>   104448 1206272 0x83
>   EOF
> 
> result:
> 
>   sfdisk -uS -l /dev/sdb
> 
>   Device Boot       Start       End   #sectors  Id  System
>   /dev/sdb1          2048    104447     102400  83  Linux
>   /dev/sdb2        104448   1310719    1206272  83  Linux
> 
> 
> My suggestion is to use fdisk rather than sfdisk, if you really need
> create partitions from script than is probably the best way to to
> create the partitions by fdisk and then dump the layout by 
> 
>    sfdisk -uS -d <dev> > part.txt
> 
> and then call from scripts
> 
>    sfdisk <dev> < part.txt
> 
> or use the latest versions of GNU Parted.

Well, that is my next step, my intention was to script this into a copy-pastable format. I'll look more seriously into parted then. Thanks.

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

--
To unsubscribe from this list: send the line "unsubscribe util-linux-ng" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux