6

I would like to partition a disk, but some partitions should not be mounted, so far I have to following workaround :

part /srv/tmp1 --fstype=ext4 --size=1000 --ondisk=sda

then in a post-install script the partition is removed from fstab, /srv/tmp1 is umounted then deleted.

I would like to know if there is a 100% kickstart solution ?

chicks
  • 1,112
  • 1
  • 9
  • 27
willll
  • 161
  • 1
  • 4
  • I don't think so. The only thing I can think of would be to leave the mntpt part out, i.e. `part --fstype=ext4 --size=1000 --ondisk=sda` but I very much doubt this will work. – Dani_l Oct 08 '15 at 20:08

1 Answers1

2

I have been trying to do something similar using the kickstart %pre script to partition the disk.

In the %pre script, I have to create 3 primary partitions with the rest of the disk as an extended partition containing several logical partitions:

    %pre
    # clear the MBR and partition table
    dd if=/dev/zero of=${targetDisk} bs=512 count=1
    # setup partition table on disk
    parted -s ${targetDisk} mklabel msdos
    parted -s ${targetDisk} mkpart primary    1049k  106M 
    parted -s ${targetDisk} mkpart primary    106M   4401M
    parted -s ${targetDisk} mkpart primary    4401M  6548M
    parted -s ${targetDisk} mkpart extended   6548M  160G
    parted -s ${targetDisk} mkpart logical    6550M  38.8G
    parted -s ${targetDisk} mkpart logical    38.8G  54.9G
    sleep 2
    # wait for all devices to be identified by the kernel
    while [ -z $(ls ${targetDisk}15) ]
    do
       echo "waiting for kernel to recognize partitions"
       hdparm -z ${targetDisk}
       sleep 1
    done

Then in the partition section of the kickstart file:

    # declare the partition configuration created in the %pre script
    part  /boot    --fstype  ext2   --onpart=/dev/sda1
    part  /        --fstype  ext3   --onpart=/dev/sda2
    part  /var     --fstype  ext3   --onpart=/dev/sda3
    part  swap     --fstype  ext3   --onpart=/dev/sda5
    part  /home    --fstype  ext3   --onpart=/dev/sda6

I have a total of 15 partitions. The wait and reload partitions at the end was needed to solve an issue where sometimes during the kickstart install not all of the disk /dev/sda## special device files were created causing the install to fail.