Last active
March 15, 2021 00:17
-
-
Save SamSirry/3e339deeb3c4f3fd05c2c6486e05aaab to your computer and use it in GitHub Desktop.
Moving the Linux OS root to zfsroot
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Moving the OS to the zfsroot. | |
Source: | |
https://www.reddit.com/r/zfs/comments/9zr5gr/which_linux_disro_is_the_most_stable_and/eadpmgm/?context=3 | |
https://web.archive.org/web/20210226222225if_/https://www.reddit.com/r/zfs/comments/9zr5gr/which_linux_disro_is_the_most_stable_and/ | |
Original code follows later. simplified code is here. USE THE ORIGINAL CODE after adaptation. | |
add-apt-repository universe | |
apt update | |
apt install zfs-initramfs | |
zpool create -o ashift=12 -o mountpoint=none ... | |
zpool export os | |
zpool import -R /z os -d /dev/disk/by-id | |
zfs create -o mountpoint=/ os/linux | |
rsync -aHSXAx /target/ /z/ | |
for d in dev dev/pts proc sys run ; do mount -o bind /{,z/}$d ; done | |
echo "Make sure zfs module doesn't eat half your RAM, adjust as you want but don't make them equal"; | |
echo "options zfs zfs_arc_min=$((128*1024*1024))" >> /z/etc/modprobe.d/zfs.conf | |
echo "options zfs zfs_arc_max=$((256*1024*1024))" >> /z/etc/modprobe.d/zfs.conf | |
chroot /z/ add-apt-repository universe | |
chroot /z/ apt update | |
chroot /z/ apt install zfs-initramfs | |
chroot /z/ update-initramfs -c -k all | |
chroot /z/ update-grub | |
chroot /z/ grub-install /dev/sda | |
for d in dev/pts dev proc sys run ; do umount /z/$d ; done | |
----------------------------------------------------------------------- | |
Original code: | |
add-apt-repository universe && apt update && apt install zfs-initramfs | |
zpool create -o ashift=12 -O mountpoint=none ... && zpool export os && zpool import -R /z os -d /dev/disk/by-id && zfs create -o mountpoint=/ os/linux | |
rsync -aHSXAx /target/ /z/ && for d in dev dev/pts proc sys run ; do mount -o bind /{,z/}$d ; done | |
echo "Make sure zfs module doesn't eat half your RAM, adjust as you want but don't make them equal"; echo "options zfs zfs_arc_min=$((128*1024*1024))" >> /z/etc/modprobe.d/zfs.conf ; echo "options zfs zfs_arc_max=$((256*1024*1024))" >> /z/etc/modprobe.d/zfs.conf | |
chroot /z/ add-apt-repository universe && chroot /z/ apt update && chroot /z/ apt install zfs-initramfs | |
chroot /z/ update-initramfs -c -k all && chroot /z/ update-grub && chroot /z/ grub-install /dev/sda | |
for d in dev/pts dev proc sys run ; do umount /z/$d ; done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment