[CentOS] fdisk on centos 6

Fri Sep 16 12:41:32 UTC 2011
Jerry Geis <geisj at pagestation.com>

On 09/16/2011 08:37 AM, Steve Clark wrote:
> On 09/16/2011 08:10 AM, Jerry Geis wrote:
>> On 09/16/2011 06:59 AM, Steve Clark wrote:
>>> On 09/15/2011 06:03 PM, Jerry Geis wrote:
>>>>> I think the fdisk in 6 tries to align on 4k boundaries. Does fdisk -c do the
>>>>> same thing?
>>>>>
>>>> Scott - thanks I just tried -cu and same result.
>>>>
>>>> jerry
>>>>
>>>> _______________________________________________
>>>> CentOS mailing list
>>>> CentOS at centos.org
>>>> http://lists.centos.org/mailman/listinfo/centos
>>>>
>>> have you tried sfdisk?
>>>
>>>
>> Steve - I had not - but asking sfdisk to list the device on centos has
>> the wrong geometry to start
>> with just like fdisk does. it should be 255 heads and 63 sectors.
>>
>> sfdisk -v
>> sfdisk (util-linux-ng 2.17.2)
>>
>>    sfdisk -l /dev/sde
>>
>> Disk /dev/sde: 1022 cylinders, 247 heads, 62 sectors/track
>> Warning: The partition table looks like it was made
>>     for C/H/S=*/255/63 (instead of 1022/247/62).
>> For this listing I'll assume that geometry.
>> Units = cylinders of 8225280 bytes, blocks of 1024 bytes, counting from 0
>>
>>      Device Boot Start     End   #cyls    #blocks   Id  System
>> /dev/sde1   *      0+    974-    975-   7830616+   b  W95 FAT32
>>           end: (c,h,s) expected (974,221,63) found (1023,254,63)
>> /dev/sde2          0       -       0          0    0  Empty
>> /dev/sde3          0       -       0          0    0  Empty
>> /dev/sde4          0       -       0          0    0  Empty
>>
>>
>> ----------------
>> This is centos 5
>> sfdisk -v
>> sfdisk (util-linux 2.13-pre7)
>>
>>    sfdisk -l /dev/sdb
>>
>> Disk /dev/sdb: 974 cylinders, 255 heads, 63 sectors/track
>> Units = cylinders of 8225280 bytes, blocks of 1024 bytes, counting from 0
>>
>>      Device Boot Start     End   #cyls    #blocks   Id  System
>> /dev/sdb1   *      0+    851     852-   6843658+  83  Linux
>> /dev/sdb2        852     973     122     979965   82  Linux swap / Solaris
>> /dev/sdb3          0       -       0          0    0  Empty
>> /dev/sdb4          0       -       0          0    0  Empty
>>
>>
> Hmm...
> I have an automated script that installs C6 on devices - I have used 
> it on sata drives, ssds and
> CF. The first thing I do is dd of=$DRIVE if=/dev/zero bs=1024 count=1 
> to wipe out the existing
> partition table then I do
>
> # 1MB = 2048 512byte sectors
> DSIZE=`sfdisk -s -uS $DRIVE`
> DSIZE=$((DSIZE*2))
> Log "DSIZE is $DSIZE"
> #OFFSET=2048
> OFFSET=8
> SWAP=1000000
> BOOT=600000
> PSIZE=$(((DSIZE-(OFFSET+BOOT+SWAP+10))/2))
> PSIZE=$((PSIZE+(PSIZE%2)))
> PSTART=$((PSIZE+BOOT+SWAP+OFFSET))
> Log "PSIZE is $PSIZE"
> Log "PSTART is $PSTART"
> # partition the disk for /boot, swap, /
> #/sbin/sfdisk -q -uS $DRIVE << EOF
> #8,600000,L,*
> #,1000000,S
> #,,L
> #EOF
> /sbin/sfdisk -f -q -uS $DRIVE << EOF
> $OFFSET,$BOOT,L,*
> $((OFFSET+BOOT)),$SWAP,S
> $((OFFSET+BOOT+SWAP)),$PSIZE,L
> $PSTART,,L
> EOF
>
> I am creating two linux partitions and a swap partition.
> The swap is fixed and the two linux partitions are approximately
> equal.
> I have had no problem booting C6 after doing this.
>
>
Steve,

Thanks - I will try this script probably Monday - heading out today.

Jerry