https://access.redhat.com/solutions/44613
环境
- Red Hat Enterprise Linux 5
问题
-
How to change the change the starting block of a partition inside the kickstart itself?
-
For example, 63 is the default. How to change it to 128.
$ /sbin/fdisk -lu Disk /dev/sda: 160.0 GB, 160000000000 bytes 255 heads, 63 sectors/track, 19452 cylinders, total 312500000 sectors Units = sectors of 1 * 512 = 512 bytes Device Boot Start End Blocks Id System /dev/sda1 * 63 401624 200781 83 Linux /dev/sda2 401625 304303229 151950802+ 8e Linux LVM /dev/sda3 304303230 312496379 4096575 82 Linux swap / Solaris Disk /dev/sdb: 160.0 GB, 160000000000 bytes 255 heads, 63 sectors/track, 19452 cylinders, total 312500000 sectors Units = sectors of 1 * 512 = 512 bytes Device Boot Start End Blocks Id System /dev/sdb1 * 63 312496379 156248158+ 8e Linux LVM
决议
Yes Partition alignment in kickstart is possible. To change the start sector from 63 to something like 128 or similar check the below example kickstart script.
clearpart --none
part /boot --fstype ext3 --onpart=sda1
part pv.01 --onpart=sda2
volgroup myvg pv.01
logvol / --fstype ext3 --name=lv_root --vgname=myvg --size=4096 --grow
logvol swap --fstype swap --name=lv_swap --size=512 --vgname=myvg
%pre
DISK=/dev/sda
dd if=/dev/zero of=$DISK bs=1024 count=1
fdisk $DISK << EOF
n
p
1
+100M
x
b
1
128
w
EOF
fdisk $DISK << EOF
n
p
2
x
b
2
208848
w
EOF