Version 6 (modified by root, at 2016-05-15T16:42:56Z) (diff) |
---|
centos 7 zfs on root
содержание
сам процесс
yum install kernel-devel zfs gdisk zfs-dracut sed -i 's#ZFS=${rpool}${bootfs}##' /etc/grub.d/10_linux sed -i 's#ZPOOL_IMPORT_OPTS=""#ZPOOL_IMPORT_OPTS="-d /dev/disk/by-partlabel"#' /usr/lib/dracut/modules.d/90zfs/zfs-lib.sh for i in b c d; do sgdisk -g \ -n 1:2048:2099199 /dev/sd${i} \ -t 1:ef02 /dev/sd${i} \ -c 1:boot-${i} \ -n 2:2099200:18876415 /dev/sd${i} \ -t 2:fd00 /dev/sd${i} \ -c 2:swap-${i} \ -n 3:18876416:1629487070 /dev/sd${i} \ -t 3:bf00 /dev/sd${i} \ -c 3:main-${i} done mdadm --create /dev/md22 \ --level=1 --raid-devices=3 \ /dev/sdb2 \ /dev/sdc2 \ /dev/sdd2 mkswap -L swap-m /dev/md22 zpool create \ -o ashift=12 \ -O compression=lz4 \ zroot \ raidz2 /dev/disk/by-partlabel/main-[b-d] zfs create zroot/centos7-01 mkdir /mnt/tmp mount --bind / /mnt/tmp rsync -avPX /mnt/tmp/. /zroot/centos7-01/. umount /mnt/tmp cat <<EOF >/zroot/centos7-01/fstab LABEL=boot-m /boot ext4 defaults 0 0 LABEL=swap-m swap swap defaults 0 0 EOF mdadm --create /dev/md11 \ --level=1 --raid-devices=3 \ /dev/sdb1 \ /dev/sdc1 \ /dev/sdd1 mkfs.ext4 -L boot-m /dev/md11 mount /dev/md11 /zroot/centos7-01/boot mount --bind /boot /mnt/tmp rsync -avPX /mnt/tmp/. /zroot/centos7-01/boot/. umount /mnt/tmp for dir in proc sys dev; do mount --bind /$dir /zroot/centos7-01/$dir done for dir in proc sys dev; do mount --bind /$dir /mnt/$dir done vi /etc/default/grub GRUB_CMDLINE_LINUX="crashkernel=auto root=zfs:zroot/centos7-01" mdadm --examine --scan | sed 's# /dev/md/# /dev/md#g' >/etc/mdadm.conf ln -s /dev/disk/by-partlabel/* /dev dracut -f -v /boot/initramfs-$(uname -r).img $(uname -r) grub2-mkconfig -o /boot/grub2/grub.cfg grep root /boot/grub2/grub.cfg for d in /dev/sd[b-d]; do grub2-install --boot-directory=/boot ${d} done exit