[CentOS] fdisk on centos 6

Fri Sep 16 12:37:55 UTC 2011
Steve Clark <sclark at netwolves.com>

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.


-- 
Stephen Clark
*NetWolves*
Sr. Software Engineer III
Phone: 813-579-3200
Fax: 813-882-0209
Email: steve.clark at netwolves.com
http://www.netwolves.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.centos.org/pipermail/centos/attachments/20110916/1839db73/attachment-0005.html>