From a1ce0bcf894bb99ddf28e6cee623e85153186dd0 Mon Sep 17 00:00:00 2001 From: Richard Laager Date: Wed, 4 Jan 2017 19:23:45 -0600 Subject: [PATCH] Update Debian instructions This modifies Ubuntu-16.04-Root-on-ZFS.md for Debian Jessie as proposed by George Melikov in #5536. --- Debian-Jessie-Root-on-ZFS.md | 479 ++++++++++++++++++ Debian.md | 4 +- ...cross-mounting-and-full-disk-encryption.md | 4 +- ...U-Linux-to-a-Native-ZFS-Root-Filesystem.md | 387 -------------- Ubuntu-16.04-Root-on-ZFS.md | 23 +- Ubuntu-16.10-Root-on-ZFS.md | 22 +- Ubuntu-17.04-Root-on-ZFS.md | 22 +- _Sidebar.md | 4 +- 8 files changed, 518 insertions(+), 427 deletions(-) create mode 100644 Debian-Jessie-Root-on-ZFS.md delete mode 100644 HOWTO-install-Debian-GNU-Linux-to-a-Native-ZFS-Root-Filesystem.md diff --git a/Debian-Jessie-Root-on-ZFS.md b/Debian-Jessie-Root-on-ZFS.md new file mode 100644 index 0000000..5503feb --- /dev/null +++ b/Debian-Jessie-Root-on-ZFS.md @@ -0,0 +1,479 @@ +### Caution +* This HOWTO uses a whole physical disk. +* Do not use these instructions for dual-booting. +* Backup your data. Any existing data will be lost. +* This instruction uses GRUB from the `unstable` repository for now! + +### System Requirements +* [64-bit Debian GNU/Linux Jessie Live CD](http://cdimage.debian.org/debian-cd/current-live/amd64/iso-hybrid/debian-live-8.6.0-amd64-standard.iso) +* 64-bit computer (amd64, a.k.a. x86_64) computer +* A drive which presents 512B logical sectors. Installing on a drive which presents 4KiB logical sectors (a “4Kn” drive) should work with UEFI partitioning, but this has not been tested. + +Computers that have less than 2 GiB of memory run ZFS slowly. 4 GiB of memory is recommended for normal performance in basic workloads. If you wish to use deduplication, you will need [massive amounts of RAM](http://wiki.freebsd.org/ZFSTuningGuide#Deduplication). Enabling deduplication is a permanent change that cannot be easily reverted. + +## Reporting Bugs + +If you have bugs or feature requests related to this HOWTO, please [file a new issue](https://github.com/zfsonlinux/zfs/issues/new) and mention @gmelikov and @rlaager. + +## Step 1: Prepare The Install Environment + +1.1 Boot the Debian GNU/Linux Live CD. Login with the username `user` and password `live`. + +1.2 Optional: Start the OpenSSH server in the Live CD environment: + +If you have a second system, using SSH to access the target system can be convenient. + + $ sudo sed -i "s/PasswordAuthentication no/PasswordAuthentication yes/g" \ + /etc/ssh/sshd_config + $ sudo service ssh restart + +**Hint:** You can find your IP address with `ip addr show scope global`. Then, from your main machine, connect with `ssh user@IP`. + +1.3 Become root: + + $ sudo -i + +1.4 Install ZFS in the Live CD environment: + + # echo deb http://ftp.debian.org/debian jessie-backports main contrib \ + >> /etc/apt/sources.list.d/backports.list + # apt update + # apt install --yes debootstrap gdisk linux-headers-$(uname -r) + # apt install --yes -t jessie-backports zfs-dkms + +**Note:** ZFS is in the `jessie-backports` repository. Adding that repository may result in other packages being upgraded to backported versions. + +## Step 2: Disk Formatting + +2.1 If you are re-using any disks which were previously in an MD array, zero the MD superblock now to avoid corruption if MD were to try to assemble the old array. + + # mdadm --zero-superblock --force /dev/disk/by-id/scsi-SATA_disk1 + +2.2 Partition your disk: + + Run this if you need legacy (BIOS) booting: + # sgdisk -a1 -n2:34:2047 -t2:EF02 /dev/disk/by-id/scsi-SATA_disk1 + + Run this for UEFI booting (for use now or in the future): + # sgdisk -n3:1M:+512M -t3:EF00 /dev/disk/by-id/scsi-SATA_disk1 + + Run these in all cases: + # sgdisk -n9:-8M:0 -t9:BF07 /dev/disk/by-id/scsi-SATA_disk1 + # sgdisk -n1:0:0 -t1:BF01 /dev/disk/by-id/scsi-SATA_disk1 + +Always use the long `/dev/disk/by-id/*` aliases with ZFS. Using the `/dev/sd*` device nodes directly can cause sporadic import failures, especially on systems that have more than one storage pool. + +**Hints:** +* `ls -la /dev/disk/by-id` will list the aliases. +* Are you doing this in a virtual machine? If your virtual disk is missing from `/dev/disk/by-id`, use `/dev/vda` if you are using KVM with virtio; otherwise, read the [troubleshooting](https://github.com/rlaager/zfs/wiki/HOWTO-Install-Ubuntu-to-a-Native-ZFS-Root-Filesystem#troubleshooting) section. + +2.3 Create the root pool: + + # zpool create -o ashift=12 \ + -O atime=off -O canmount=off -O compression=lz4 -O normalization=formD \ + -O mountpoint=/ -R /mnt \ + rpool /dev/disk/by-id/scsi-SATA_disk1-part1 + +**Notes:** +* The use of `ashift=12` is recommended here because many drives today have 4KiB (or larger) physical sectors, even though they present 512B logical sectors. Also, a future replacement drive may have 4KiB physical sectors (in which case `ashift=12` is desirable) or 4KiB logical sectors (in which case `ashift=12` is required). +* Setting `normalization=formD` eliminates some corner cases relating to UTF-8 filename normalization. It also implies `utf8only=on`, which means that only UTF-8 filenames are allowed. If you care to support non-UTF-8 filenames, do not use this option. For a discussion of why requiring UTF-8 filenames may be a bad idea, see [The problems with enforced UTF-8 only filenames](http://utcc.utoronto.ca/~cks/space/blog/linux/ForcedUTF8Filenames). + +**Hints:** +* The root pool does not have to be a single disk; it can have a mirror or raidz topology. In that case, repeat the partitioning commands for all the disks which will be part of the pool. Then, create the pool using `zpool create ... rpool mirror /dev/disk/by-id/scsi-SATA_disk1-part1 /dev/disk/by-id/scsi-SATA_disk2-part1` (or replace `mirror` with `raidz`, `raidz2`, or `raidz3` and list the partitions from additional disks). Later, install GRUB to all the disks. This is trivial for MBR booting; the UEFI equivalent is currently left as an exercise for the reader. +* The pool name is arbitrary. On systems that can automatically install to ZFS, the root pool is named `rpool` by default. If you work with multiple systems, it might be wise to use `hostname`, `hostname0`, or `hostname-1` instead. + +## Step 3: System Installation + +3.1 Create a filesystem dataset to act as a container: + + # zfs create -o canmount=off -o mountpoint=none rpool/ROOT + +On Solaris systems, the root filesystem is cloned and the suffix is incremented for major system changes through `pkg image-update` or `beadm`. Similar functionality for APT is possible but currently unimplemented. Even without such a tool, it can still be used for manually created clones. + +3.2 Create a filesystem dataset for the root filesystem of the Ubuntu system: + + # zfs create -o canmount=noauto -o mountpoint=/ rpool/ROOT/debian + # zfs mount rpool/ROOT/debian + # zpool set bootfs=rpool/ROOT/debian rpool + +With ZFS, it is not normally necessary to use a mount command (either `mount` or `zfs mount`). This situation is an exception because of `canmount=noauto`. + +3.3 Create datasets: + + # zfs create -o setuid=off rpool/home + # zfs create -o mountpoint=/root rpool/home/root + # zfs create -o canmount=off -o setuid=off -o exec=off rpool/var + # zfs create -o com.sun:auto-snapshot=false rpool/var/cache + # zfs create rpool/var/log + # zfs create rpool/var/spool + # zfs create -o com.sun:auto-snapshot=false -o exec=on rpool/var/tmp + + If you use /srv on this system: + # zfs create rpool/srv + + If this system will have games installed: + # zfs create rpool/var/games + + If this system will store local email in /var/mail: + # zfs create rpool/var/mail + + If this system will use NFS (locking): + # zfs create -o com.sun:auto-snapshot=false \ + -o mountpoint=/var/lib/nfs rpool/var/nfs + +The primary goal of this dataset layout is to separate the OS from user data. This allows the root filesystem to be rolled back without rolling back user data such as logs (in `/var/log`). This will be especially important if/when a `beadm` or similar utility is integrated. Since we are creating multiple datasets anyway, it is trivial to add some restrictions (for extra security) at the same time. The `com.sun.auto-snapshot` setting is used by some ZFS snapshot utilities to exclude transient data. + +3.4 Install the minimal system: + + # chmod 1777 /mnt/var/tmp + # debootstrap jessie /mnt + # zfs set devices=off rpool + +The `debootstrap` command leaves the new system in an unconfigured state. An alternative to using `debootstrap` is to copy the entirety of a working system into the new ZFS root. + +## Step 4: System Configuration + +4.1 Configure the hostname (change `HOSTNAME` to the desired hostname). + + # echo HOSTNAME > /mnt/etc/hostname + + # vi /mnt/etc/hosts + Add a line: + 127.0.1.1 HOSTNAME + or if the system has a real name in DNS: + 127.0.1.1 FQDN HOSTNAME + +**Hint:** Use `nano` if you find `vi` confusing. + +4.2 Configure the network interface: + + Find the interface name: + # ifconfig -a + + # vi /mnt/etc/network/interfaces.d/NAME + auto NAME + iface NAME inet dhcp + +Customize this file if the system is not a DHCP client. + +4.3 Bind the virtual filesystems from the LiveCD environment to the new system and `chroot` into it: + + # mount --rbind /dev /mnt/dev + # mount --rbind /proc /mnt/proc + # mount --rbind /sys /mnt/sys + # chroot /mnt /bin/bash --login + +**Note:** This is using `--rbind`, not `--bind`. + +4.4 Configure a basic system environment: + + # vi /etc/apt/preferences + Package: * + Pin: release a=stable + Pin-Priority: 700 + + Package: * + Pin: release a=jessie-backports + Pin-Priority: 650 + + Package: * + Pin: release a=testing + Pin-Priority: 600 + + Package: * + Pin: release a=unstable + Pin-Priority: 100 + + # vi /etc/apt/sources.list + deb http://ftp.debian.org/debian jessie main + deb-src http://ftp.debian.org/debian jessie main + + deb http://ftp.debian.org/debian jessie-backports main contrib + deb-src http://ftp.debian.org/debian jessie-backports main contrib + + deb http://ftp.debian.org/debian unstable main contrib + deb-src http://ftp.debian.org/debian unstable main contrib + + # ln -s /proc/self/mounts /etc/mtab + # apt update + + # apt install --yes locales + # dpkg-reconfigure locales + +Even if you prefer a non-English system language, always ensure that `en_US.UTF-8` is available. + + # dpkg-reconfigure tzdata + + # apt install --yes gdisk linux-headers-$(uname -r) linux-image-amd64 + +**Note:** ZFS needs GRUB from `unstable` for now. + +4.5 Install ZFS in the chroot environment for the new system: + + # apt install --yes -t jessie-backports zfs-dkms zfs-initramfs + + # vi /usr/share/initramfs-tools/conf.d/zfs + for x in $(cat /proc/cmdline) + do + case $x in + root=ZFS=*) + BOOT=zfs + ;; + esac + done + +4.6 Install GRUB + +Choose one of the following options: + +4.6a Install GRUB for legacy (MBR) booting + + # apt install --yes -t unstable grub-pc + +4.6b Install GRUB for UEFI booting + + # apt install dosfstools + # mkdosfs -F 32 -n EFI /dev/disk/by-id/scsi-SATA_disk1-part3 + # mkdir /boot/efi + # echo PARTUUID=$(blkid -s PARTUUID -o value \ + /dev/disk/by-id/scsi-SATA_disk1-part3) \ + /boot/efi vfat defaults 0 1 >> /etc/fstab + # mount /boot/efi + # apt install --yes -t unstable grub-efi-amd64 + +4.7 Set a root password + + # passwd + +## Step 5: GRUB Installation + +5.1 Verify that the ZFS root filesystem is recognized: + + # grub-probe / + zfs + +5.2 Refresh the initrd files: + + # update-initramfs -u -k all + update-initramfs: Generating /boot/initrd.img-3.16.0-4-amd64 + +5.3 Optional (but highly recommended): Make debugging GRUB easier: + + # vi /etc/default/grub + Remove quiet from: GRUB_CMDLINE_LINUX_DEFAULT + Uncomment: GRUB_TERMINAL=console + Save and quit. + +Later, once the system has rebooted twice and you are sure everything is working, you can undo these changes, if desired. + +5.4 Update the boot configuration: + + # update-grub + Generating grub configuration file ... + Found linux image: /boot/vmlinuz-3.16.0-4-amd64 + Found initrd image: /boot/initrd.img-3.16.0-4-amd64 + done + +5.5 Install the boot loader + +5.5a For legacy (MBR) booting, install GRUB to the MBR: + + # grub-install /dev/disk/by-id/scsi-SATA_disk1 + Installing for i386-pc platform. + Installation finished. No error reported. + +Do not reboot the computer until you get exactly that result message. Note that you are installing GRUB to the whole disk, not a partition. + +If you are creating a mirror, repeat the grub-install command for each disk in the pool. + +5.5b For UEFI booting, install GRUB: + + # grub-install --target=x86_64-efi --efi-directory=/boot/efi \ + --bootloader-id=ubuntu --recheck --no-floppy + +5.6 Verify that the ZFS module is installed: + + # ls /boot/grub/*/zfs.mod + +## Step 6: First Boot + +6.1 Snapshot the initial installation: + + # zfs snapshot rpool/ROOT/ubuntu@install + +In the future, you will likely want to take snapshots before each upgrade, and remove old snapshots (including this one) at some point to save space. + +6.2 Exit from the `chroot` environment back to the LiveCD environment: + + # exit + +6.3 Run these commands in the LiveCD environment to unmount all filesystems: + + # mount | grep -v zfs | tac | awk '/\/mnt/ {print $3}' | xargs -i{} umount -lf {} + # zpool export rpool + +6.4 Reboot: + + # reboot + +6.5 Wait for the newly installed system to boot normally. Login as root. + +6.6 Create a user account: + + # zfs create rpool/home/YOURUSERNAME + # adduser YOURUSERNAME + # cp -a /etc/skel/.[!.]* /home/YOURUSERNAME + # chown -R YOURUSERNAME:YOURUSERNAME /home/YOURUSERNAME + +6.7 Add your user account to the default set of groups for an administrator: + + # usermod -a -G audio,cdrom,dip,floppy,netdev,plugdev,sudo,video YOURUSERNAME + +## Step 7: Configure Swap + +7.1 Create a volume dataset (zvol) for use as a swap device: + + # zfs create -V 4G -b $(getconf PAGESIZE) -o compression=zle \ + -o logbias=throughput -o sync=always \ + -o primarycache=metadata -o secondarycache=none \ + -o com.sun:auto-snapshot=false rpool/swap + +You can adjust the size (the `4G` part) to your needs. + +The compression algorithm is set to `zle` because it is the cheapest available algorithm. As this guide recommends `ashift=12` (4 kiB blocks on disk), the common case of a 4 kiB page size means that no compression algorithm can reduce I/O. The exception is all-zero pages, which are dropped by ZFS; but some form of compression has to be enabled to get this behavior. + +7.2 Configure the swap device: + +Choose one of the following options. If you are going to do an encrypted home directory later, you should use encrypted swap. + +7.2a Create an unencrypted (regular) swap device: + +**Caution**: Always use long `/dev/zvol` aliases in configuration files. Never use a short `/dev/zdX` device name. + + # mkswap -f /dev/zvol/rpool/swap + # echo /dev/zvol/rpool/swap none swap defaults 0 0 >> /etc/fstab + +7.2b Create an encrypted swap device: + + # echo cryptswap1 /dev/zvol/rpool/swap /dev/urandom \ + swap,cipher=aes-xts-plain64:sha256,size=256 >> /etc/crypttab + # systemctl daemon-reload + # systemctl start systemd-cryptsetup@cryptswap1.service + # echo /dev/mapper/cryptswap1 none swap defaults 0 0 >> /etc/fstab + +7.3 Enable the swap device: + + # swapon -av + +## Step 8: Full Software Installation + +8.1 Upgrade the minimal system: + + # apt dist-upgrade --yes + +8.2 Optional: Disable log compression: + +As `/var/log` is already compressed by ZFS, logrotate’s compression is going to burn CPU and disk I/O for (in most cases) very little gain. Also, if you are making snapshots of `/var/log`, logrotate’s compression will actually waste space, as the uncompressed data will live on in the snapshot. You can edit the files in `/etc/logrotate.d` by hand to comment out `compress`, or use this loop (copy-and-paste highly recommended): + + # for file in /etc/logrotate.d/* ; do + if grep -Eq "(^|[^#y])compress" "$file" ; then + sed -i -r "s/(^|[^#y])(compress)/\1#\2/" "$file" + fi + done + +8.3 Reboot: + + # reboot + +### Step 9: Final Cleanup + +9.1 Wait for the system to boot normally. Login using the account you created. Ensure the system (including networking) works normally. + +9.2 Optional: Delete the snapshot of the initial installation: + + $ sudo zfs destroy rpool/ROOT/ubuntu@install + +9.3 Optional: Disable the root password + + $ sudo usermod -p '*' root + +9.4 Optional (not recommended): + +If you prefer the graphical boot process, you can re-enable it now. It will make debugging boot problems more difficult, though. + + $ sudo vi /etc/default/grub + Add quiet to GRUB_CMDLINE_LINUX_DEFAULT + Comment out GRUB_TERMINAL=console + Save and quit. + + $ sudo update-grub + +## Troubleshooting + +### Rescuing using a Live CD + +Boot the Live CD and open a terminal. + +Become root and install the ZFS utilities: + + $ sudo -i + # echo deb http://ftp.debian.org/debian jessie-backports main contrib \ + >> /etc/apt/sources.list.d/backports.list + # apt update + # apt install --yes linux-headers-$(uname -r) + # apt install --yes -t jessie-backports zfs-dkms + +This will automatically import your pool. Export it and re-import it to get the mounts right: + + # zpool export -a + # zpool import -N -R /mnt rpool + # zfs mount rpool/ROOT/debian + # zfs mount -a + +If needed, you can chroot into your installed environment: + + # mount --rbind /dev /mnt/dev + # mount --rbind /proc /mnt/proc + # mount --rbind /sys /mnt/sys + # chroot /mnt /bin/bash --login + +Do whatever you need to do to fix your system. + +When done, cleanup: + + # mount | grep -v zfs | tac | awk '/\/mnt/ {print $3}' | xargs -i{} umount -lf {} + # zpool export rpool + # reboot + +### MPT2SAS + +Most problem reports for this tutorial involve `mpt2sas` hardware that does slow asynchronous drive initialization, like some IBM M1015 or OEM-branded cards that have been flashed to the reference LSI firmware. + +The basic problem is that disks on these controllers are not visible to the Linux kernel until after the regular system is started, and ZoL does not hotplug pool members. See https://github.com/zfsonlinux/zfs/issues/330. + +Most LSI cards are perfectly compatible with ZoL. If your card has this glitch, try setting rootdelay=X in GRUB_CMDLINE_LINUX. The system will wait up to X seconds for all drives to appear before importing the pool. + +### Areca + +Systems that require the `arcsas` blob driver should add it to the `/etc/initramfs-tools/modules` file and run `update-initramfs -c -k all`. + +Upgrade or downgrade the Areca driver if something like `RIP: 0010:[] [] native_read_tsc+0x6/0x20` appears anywhere in kernel log. ZoL is unstable on systems that emit this error message. + +### VMware + +* Set `disk.EnableUUID = "TRUE"` in the vmx file or vsphere configuration. Doing this ensures that `/dev/disk` aliases are created in the guest. + +### QEMU/KVM/XEN + +Set a unique serial number on each virtual disk using libvirt or qemu (e.g. `-drive if=none,id=disk1,file=disk1.qcow2,serial=1234567890`). + +To be able to use UEFI in guests (instead of only BIOS booting), run this on the host: + + $ sudo apt install ovmf + $ sudo vi /etc/libvirt/qemu.conf + Uncomment these lines: + nvram = [ + "/usr/share/OVMF/OVMF_CODE.fd:/usr/share/OVMF/OVMF_VARS.fd", + "/usr/share/AAVMF/AAVMF_CODE.fd:/usr/share/AAVMF/AAVMF_VARS.fd" + ] + $ sudo service libvirt-bin restart diff --git a/Debian.md b/Debian.md index 45c554a..0e3a1e4 100644 --- a/Debian.md +++ b/Debian.md @@ -28,5 +28,5 @@ If you want to boot from ZFS, you'll need `zfs-initramfs` package too: [debian-itp]: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=686447 * [[Debian GNU Linux initrd documentation]] -* [[HOWTO install Debian GNU Linux to a Native ZFS Root Filesystem]] -* [[Dual booting OS X and Debian Jessie with ZFS root, cross mounting and full disk encryption]] \ No newline at end of file +* [[Debian Jessie Root on ZFS]] +* [[Dual booting OS X and Debian Jessie with ZFS root, cross mounting and full disk encryption]] diff --git a/Dual-booting-OS-X-and-Debian-Jessie-with-ZFS-root,-cross-mounting-and-full-disk-encryption.md b/Dual-booting-OS-X-and-Debian-Jessie-with-ZFS-root,-cross-mounting-and-full-disk-encryption.md index f4be130..88a3c07 100644 --- a/Dual-booting-OS-X-and-Debian-Jessie-with-ZFS-root,-cross-mounting-and-full-disk-encryption.md +++ b/Dual-booting-OS-X-and-Debian-Jessie-with-ZFS-root,-cross-mounting-and-full-disk-encryption.md @@ -122,8 +122,6 @@ Click "Dismount" in the TrueCrypt GUI to close the container. ## Step 4: Install Debian Jessie -This is loosely modeled after [HOWTO install Debian GNU Linux to a Native ZFS Root Filesystem](HOWTO-install-Debian-GNU-Linux-to-a-Native-ZFS-Root-Filesystem), I'll skip over details that are thoroughly explained there. - I decided to do an offline installation without any need for Internet access, one of the reasons being that most contemporary Macs use Broadcom Ethernet chips which require proprietary firmware and @@ -257,4 +255,4 @@ $ reboot Because we invoked gummiboot with `--no-variables`, the NVRAM variable `efi-boot-device` was left untouched and the system will boot OS X by default. To boot Linux, hold down the option key during startup and -select the disk icon labeled "EFI Boot". \ No newline at end of file +select the disk icon labeled "EFI Boot". diff --git a/HOWTO-install-Debian-GNU-Linux-to-a-Native-ZFS-Root-Filesystem.md b/HOWTO-install-Debian-GNU-Linux-to-a-Native-ZFS-Root-Filesystem.md deleted file mode 100644 index 08cc90b..0000000 --- a/HOWTO-install-Debian-GNU-Linux-to-a-Native-ZFS-Root-Filesystem.md +++ /dev/null @@ -1,387 +0,0 @@ ---------- ---------- ---------- -**WARNING - this instruction is outdated.** ---------- -Now ZFS packages are provided by Debian [backports repository](https://backports.debian.org/Instructions/). - -[See this page](https://github.com/zfsonlinux/zfs/wiki/Debian) for more info. - -This instruction will be updated soon, for now you can use [beta version of HOWTO for Debian Jessie](https://github.com/zfsonlinux/zfs/issues/5536#issuecomment-269687475). - -**WARNING - this instruction is outdated.** ---------- ---------- ---------- ---------- - -These instructions are for Debian GNU/Linux. It is an almost exact clone of the [HOWTO install Ubuntu to a Native ZFS Root Filesystem](https://github.com/zfsonlinux/pkg-zfs/wiki/HOWTO-install-Ubuntu-to-a-Native-ZFS-Root-Filesystem) procedure with some very small differences. - -### System Requirements - * 64-bit Debian GNU/Linux Live CD. (Not the alternate installer, and not the 32-bit installer!) - For wheezy, have a look at [Debian GNU/Linux live cd - Wheezy](http://cdimage.debian.org/debian-cd/current-live/amd64/iso-hybrid/). - * AMD64 or EM64T compatible computer. (ie: x86-64) - * 8GB disk storage available. - * 2GB memory minimum. - -Computers that have less than 2GB of memory run ZFS slowly. 4GB of memory is recommended for normal performance in basic workloads. 16GB of memory is the recommended minimum for deduplication. Enabling deduplication is a permanent change that cannot be easily reverted. - -### Latest Tested And Recommended Version -* Debian GNU/Linux 7.2 Wheezy (live cd debian-live-7.2-amd64-standard.iso -* spl-0.6.2 -* zfs-0.6.2 - -## Step 1: Prepare The Install Environment - -1.1 Start the Debian GNU/Linux LiveCD. The tested iso will not start a graphical interface. Instead you will have a virtual terminal. - -1.2 Input these commands at the terminal prompt: - - $ sudo -i - # wget http://archive.zfsonlinux.org/debian/pool/main/z/zfsonlinux/zfsonlinux_6_all.deb - # dpkg -i zfsonlinux_6_all.deb - # apt-get update - # apt-get install linux-image-amd64 debian-zfs - -**Note:** Installing the image is just to make sure that you get a working kernel - ZoL won't compile on a RT kernel. - -1.3 Check that the ZFS filesystem is installed and available: - - # modprobe zfs - # dmesg | grep ZFS: - [ 5.588948] ZFS: Loaded module v0.6.2-524_gd6385c9, ZFS pool version 5000, ZFS filesystem version 5 - -## Step 2: Disk Partitioning - -This tutorial intentionally recommends a small USB or extra disk using MBR partitioning used for the /boot filesystem. GPT can be used instead, but beware of UEFI firmware bugs. - -2.1 Run your favorite disk partitioner, like `parted` or `cfdisk`, on the boot device. `/dev/disk/by-id/scsi-SATA_disk1` is the example device used in this document. The device to use for the ZFS root is in this example named `/dev/disk/by-id/scsi-SATA_disk2`. - -2.2 Create a small MBR primary partition of **at least** 150 megabytes. `/dev/disk/by-id/scsi-SATA_disk1-part1` is the example boot partition used in this document. - -2.3 On this first small partition, set `type=83` and enable the `bootable` flag. - -2.4 If this is not a USB device, create a swap partition (`type=82`) of any size you want. - -The partition table should look like this: - - # fdisk -l /dev/disk/by-id/scsi-SATA_disk1 - - Disk /dev/sda: 8589 MB, 8589934592 bytes - 255 heads, 63 sectors/track, 1044 cylinders, total 16777216 sectors - Units = sectors of 1 * 512 = 512 bytes - Sector size (logical/physical): 512 bytes / 512 bytes - I/O size (minimum/optimal): 512 bytes / 512 bytes - Disk identifier: 0x00000000 - - Device Boot Start End Blocks Id System - /dev/sda1 * 2048 10487807 5242880 83 Linux - /dev/sda2 10487808 16777215 3144704 82 Linux swap / Solaris - -**Remember:** Substitute `scsi-SATA_disk1-part1` and `scsi-SATA_disk1-part2` appropriately below. - -**Hints:** -* Are you doing this in a virtual machine? Is some something in `/dev/disk/by-id` is missing? Go read the troubleshooting section. -* Recent GRUB releases assume that the `/boot/grub/grubenv` file is writable by the stage2 module. Until GRUB gets a ZFS write enhancement, the GRUB modules should be installed to a separate filesystem in a separate partition that is grub-writable. -* If `/boot/grub` is in the ZFS filesystem, then GRUB will fail to boot with this message: `error: sparse file not allowed`. If you absolutely want only one filesystem, then remove the call to `recordfail()` in each `grub.cfg` menu stanza, and edit the `/etc/grub.d/10_linux` file to make the change permanent. -* Alternatively, if `/boot/grub` is in the zfs filesystem you can comment each line with the text `save_env` in the file `/etc/grub.d/00_header` and run update-grub. - - -## Step 3: Disk Formatting - -3.1 Format the small boot partition created by Step 2.2 as a filesystem that has stage1 GRUB support like this: - - # mke2fs -m 0 -L /boot/grub -j /dev/disk/by-id/scsi-SATA_disk1-part1 - -3.2 Create a swap area on the second partition if one was created: - - # mkswap -L swap /dev/disk/by-id/scsi-SATA_disk1-part2 - -3.3 Create the root pool on the second device: - - # zpool create -o ashift=12 -o altroot=/mnt -m none rpool /dev/disk/by-id/scsi-SATA_disk2 - # zfs set atime=off rpool - -Always use the long /dev/disk/by-id/* aliases with ZFS. Using the /dev/sd* device nodes directly can cause sporadic import failures, especially on systems that have more than one storage pool. - -**NOTE:** It is the ZoL developers recommendation that you always enable ashift=12 to accomodate future disks. - -**Hints:** -* `# ls -la /dev/disk/by-id` will list the aliases. -* The root pool can be a mirror. For example, `zpool create -o ashift=12 rpool mirror /dev/disk/by-id/scsi-SATA_disk2 /dev/disk/by-id/scsi-SATA_disk3`. Remember that the version and ashift matter for any pool that GRUB must read, and that these things are difficult to change after pool creation. -* If you are using a mirror with a separate boot device as described above, don't forget to edit the grub.cfg file on the second HD partition so that the "root=" partition refers to that partition on the second HD also; otherwise, if you lose the first disk, you won't be able to boot from the second because the kernel will keep trying to mount the root partition from the first disk. -* The latest GRUB (2.01-22debian1+zfs3~wheezy) can boot from any type of RAID-Z groups. For example, `zpool create -o ashift=12 rpool raidz3 /dev/disk/by-id/scsi-SATA_disk[2-6]`. -* The pool name is arbitrary. On systems that can automatically install to ZFS, the root pool is named "rpool" by default. Note that system recovery is easier if you choose a unique name instead of "rpool". Anything except "rpool" or "tank", like the hostname, would be a good choice. If you DO choose to name your pool by any other name, the grub boot option `rpool` can be used to specify this. - - -3.4 Create a "ROOT" filesystem in the root pool: - - # zfs create -o mountpoint=none rpool/ROOT - -3.5 Create a descendant filesystem for the Debian GNU/Linux system: - - # zfs create -o mountpoint=/ rpool/ROOT/debian-1 - -On Solaris systems, the root filesystem is cloned and the suffix is incremented for major system changes through `pkg image-update` or `beadm`. Similar functionality for APT is possible but currently unimplemented. - -**NOTE:** if you prefer, you can name the root filesystem you like. Just use the appropriate grub boot option `bootfs`. For example: `zfs create zfspool/hostname`. This would need the following grub boot commandline: `rpool=zfspool bootfs=zfspool/hostname` (replace `hostname` with the actual hostname of the machine). - -3.6 Set the `bootfs` property on the root pool. - - # zpool set bootfs=rpool/ROOT/debian-1 rpool - -The boot loader uses these two properties to find and start the operating system. These property names are *not* arbitrary, although their values are (as long as they corresponds with the reality). - -3.7 Creating File Systems (not necessary): - - # zfs create -o mountpoint=/home zroot/home - # zfs create -o mountpoint=/usr -o canmount=off zroot/usr - # zfs create -o mountpoint=/var zroot/var - # zfs create -o compression=lz4 -o atime=on zroot/var/mail - # zfs create -o compression=lz4 -o setuid=off -o exec=off zroot/var/log - # zfs create -o compression=lz4 -o setuid=off -o exec=off zroot/var/tmp - # zfs create -o mountpoint=/tmp -o compression=lz4 -o setuid=off -o exec=off rpool/tmp - -3.8 Export the pool: - - # zpool export rpool - -Don't skip this step. The system is put into an inconsistent state if this command fails or if you reboot at this point. - - -## Step 4: System Installation - -**Remember:** Substitute "rpool" for the name chosen in Step 3.2. - -4.1 Import the pool: - - # zpool import -d /dev/disk/by-id -R /mnt rpool - # ## alternative - # zpool import -o altroot=/mnt rpool - -4.2 Place cache pool configuration: - - # mkdir -p /mnt/etc/zfs/ - # zpool set cachefile=/mnt/etc/zfs/zpool.cache rpool - -4.3 Mount the small boot filesystem for GRUB that was created in step 3.1: - - # mkdir -p /mnt/boot/grub - # mount /dev/disk/by-id/scsi-SATA_disk1-part1 /mnt/boot/grub - -4.5 Install the minimal system (read more https://www.debian.org/releases/jessie/amd64/apds03.html.en): - - # apt-get install debootstrap - # debootstrap wheezy /mnt - -The `debootstrap` command leaves the new system in an unconfigured state. In Step 5, we will only do the minimum amount of configuration necessary to make the new system runnable. - - -## Step 5: System Configuration - -5.1 Copy these files from the LiveCD environment to the new system: - - # cp /etc/hostname /mnt/etc/ - # cp /etc/hosts /mnt/etc/ - -5.2 The `/mnt/etc/fstab` file should be empty except for a comment. Add this line to the `/mnt/etc/fstab` file: - - /dev/disk/by-id/scsi-SATA_disk1-part1 /boot/grub auto defaults 0 1 - -5.3 Edit the `/mnt/etc/network/interfaces` file so that it contains something like this: - - # interfaces(5) file used by ifup(8) and ifdown(8) - auto lo - iface lo inet loopback - - auto eth0 - iface eth0 inet dhcp - -Customize this file if the new system is not a DHCP client on the LAN. - -5.4 Make virtual filesystems in the LiveCD environment visible to the new system and `chroot` into it: - - # mount --bind /dev /mnt/dev - # mount --bind /proc /mnt/proc - # mount --bind /sys /mnt/sys - # chroot /mnt /bin/bash --login - -5.5 Install the ZoL archive support in the chroot environment in the exact same way you did in point 1.2: - - # apt-get install locales - # locale-gen en_US.UTF-8 - - # wget http://archive.zfsonlinux.org/debian/pool/main/z/zfsonlinux/zfsonlinux_6_all.deb - # apt-get install lsb-release - # dpkg -i zfsonlinux_6_all.deb - # apt-get update - # apt-get install linux-image-amd64 debian-zfs - - # apt-get install grub2-common grub-pc zfs-initramfs - # apt-get dist-upgrade - -Even if you prefer a non-English system language, always ensure that en_US.UTF-8 is available. - -**Warning:** This is the second time that you must wait for the SPL and ZFS modules to compile. *Do not* try to skip this step by copying anything from the host environment into the chroot environment. - -**Note:** This should install a kernel package and its headers and dkms packages. Double-check that you are getting these packages from the ZoL archive if you are deviating from these instructions in any way. - -Choose `/dev/disk/by-id/scsi-SATA_disk1` if prompted to install the MBR loader. - -Ignore warnings that are caused by the chroot environment like: - -* `Can not write log, openpty() failed (/dev/pts not mounted?)` -* `df: Warning: cannot read table of mounted file systems` - -5.7 Set a root password on the new system: - - # passwd root - -**Note:** At this time the system have been installed on a new ZFS root system so it is clean and pristine. It would be a good idea to do a zfs snapshot here. For example: `zfs snapshot rpool/ROOT/debian-1@YYYYMMDD-cleaninstall` - -## Step 6: Cleanup and First Reboot - -6.1 Exit from the `chroot` environment back to the LiveCD environment: - - # exit - -6.2 Run these commands in the LiveCD environment to dismount all filesystems: - - # umount /mnt/boot/grub - # umount /mnt/dev - # umount /mnt/proc - # umount /mnt/sys - # zfs umount -a - # zpool export rpool - -The `zpool export` command must succeed without being forced or the new system will fail to start. - -6.3 We're done! - - # reboot - - -## Caveats and Known Problems - -### This is an experimental system configuration. - -This document was first published in 2010 to demonstrate that the `lzfs` implementation made ZoL 0.5 feature complete. Upstream integration efforts began in 2012, and it will be at least a few more years before this kind of configuration is even minimally supported. - -Gentoo, and its derivatives, are the only Linux distributions that are currently mainlining support for a ZoL root filesystem. - -### `zpool.cache` inconsistencies cause random pool import failures. - -The `/etc/zfs/zpool.cache` file embedded in the initrd for each kernel image must be the same as the `/etc/zfs/zpool.cache` file in the regular system. Run `update-initramfs -c -k all` after any `/sbin/zpool` command changes the `/etc/zfs/zpool.cache` file. - -This will be a recurring problem until issue [zfsonlinux/zfs#330](https://github.com/zfsonlinux/zfs/issues/330) is resolved. - -### Every upgrade can break the system. - -Debian GNU/Linux based systems remove old dkms modules before installing new dkms modules. If the system crashes or restarts during a ZoL module upgrade, which is a failure window of several minutes, then the system becomes unbootable and must be rescued. - -This will be a recurring problem until issue [zfsonlinux/pkg-zfs#12](https://github.com/zfsonlinux/pkg-zfs/issues/12) is resolved. - - -# Troubleshooting - -## (i) MPT2SAS - -Most problem reports for this tutorial involve `mpt2sas` hardware that does slow asynchronous drive initialization, like some IBM M1015 or OEM-branded cards that have been flashed to the reference LSI firmware. - -The basic problem is that disks on these controllers are not visible to the Linux kernel until after the regular system is started, and ZoL does not hotplug pool members. See https://github.com/zfsonlinux/zfs/issues/330. - -Most LSI cards are perfectly compatible with ZoL, but there is no known fix if your card has this glitch. Please use different equipment until the `mpt2sas` incompatibility is diagnosed and fixed, or donate an affected part if you want solution sooner. - -## (ii) Areca - -Systems that require the `arcsas` blob driver should add it to the `/etc/initramfs-tools/modules` file and run `update-initramfs -c -k all`. - -Upgrade or downgrade the Areca driver if something like `RIP: 0010:[] [] native_read_tsc+0x6/0x20` appears anywhere in kernel log. ZoL is unstable on systems that emit this error message. - - -## (iii) GRUB Installation - -Verify that the ZoL repository for the ZFS enhanced GRUB is installed: - - # rgrep -E '^deb .*archive.zfsonlinux.org' `find /etc/apt/sources.list*` - /etc/apt/sources.list.d/zfsonlinux.list:deb http://archive.zfsonlinux.org/debian wheezy main - /etc/apt/sources.list.d/zfsonlinux.list:deb http://archive.zfsonlinux.org/debian wheezy main - -If not, install the ZoL repository trust package like you did in point 1.2 and 5.5: - - # wget http://archive.zfsonlinux.org/debian/pool/main/z/zfsonlinux/zfsonlinux_3%7Ewheezy_all.deb - # dpkg -i zfsonlinux_3~wheezy_all.deb - # apt-get update - -Reinstall the `zfs-grub` package, which is an alias for a patched `grub-common` package: - - # apt-get install --reinstall zfs-grub - -Afterwards, this should happen: - - # apt-cache search zfs-grub - grub-common - GRand Unified Bootloader (common files) - grub-pc - GRand Unified Bootloader, version 2 (PC/BIOS version) - grub-pc-bin - GRand Unified Bootloader, version 2 (PC/BIOS binaries) - - # apt-cache show zfs-grub - N: Can't select versions from package 'zfs-grub' as it is purely virtual - N: No packages found - - # apt-cache policy grub-common zfs-grub - grub-common: - Installed: 2.01-22debian1+zfs3~wheezy - Candidate: 2.01-22debian1+zfs3~wheezy - Version table: - *** 2.01-22debian1+zfs3~wheezy 0 - 1001 http://archive.zfsonlinux.org/debian/ wheezy/main amd64 Packages - 100 /var/lib/dpkg/status - 1.99-27+deb7u2 0 - 500 http://ftp.us.debian.org/debian/ wheezy/main amd64 Packages - zfs-grub: - Installed: (none) - Candidate: (none) - Version table: - -For safety, grub modules are never updated by the packaging system after initial installation. Manually refresh them by doing this: - - # cp /usr/lib/grub/i386-pc/*.mod /boot/grub/i386-pc/ - -If the problem persists, then open a bug report and attach the entire output of those `apt-get` commands. - -GRUB packages in the ZoL repository are compiled against the stable distribution. - -Note that GRUB does not currently dereference symbolic links in a ZFS filesystem, so you cannot use the `/vmlinux` or `/initrd.img` symlinks as GRUB command arguments. - -## (iv) VMware - -* Set `disk.EnableUUID = "TRUE"` in the vmx file or vsphere configuration. Doing this ensures that `/dev/disk` aliases are created in the guest. - -## (v) QEMU/KVM/XEN - -* In the `/etc/default/grub` file, enable the `GRUB_TERMINAL=console` line and remove the `splash` option from the `GRUB_CMDLINE_LINUX_DEFAULT` line. Plymouth can cause boot errors in these virtual environments that are difficult to diagnose. - -* Set a unique serial number on each virtual disk. (eg: `-drive if=none,id=disk1,file=disk1.qcow2,serial=1234567890`) - -## (vi) Kernel Parameters - -The `zfs-initramfs` package requires that `boot=zfs` always be on the kernel command line. If the `boot=zfs` parameter is not set, then the init process skips the ZFS routine entirely. This behavior is for safety; it makes the casual installation of the zfs-initramfs package unlikely to break a working system. - -ZFS properties can be overridden on the the kernel command line with `rpool` and `bootfs` arguments. For example, at the GRUB prompt: - -`linux /ROOT/debian-1/@/boot/vmlinuz-3.0.0-15-generic boot=zfs rpool=AltPool bootfs=AltPool/ROOT/foobar-3` - -## (vii) System Recovery - -If the system randomly fails to import the root filesystem pool, then do this at the initramfs recovery prompt: - - # zpool export rpool - : now export all other pools too - # zpool import -d /dev/disk/by-id -f -N rpool - : now import all other pools too - # mount -t zfs -o zfsutil rpool/ROOT/debian-1 /root - : do not mount any other filesystem - # cp /etc/zfs/zpool.cache /root/etc/zfs/zpool.cache - # exit - -This refreshes the `/etc/zfs/zpool.cache` file. The `zpool` command emits spurious error messages regarding missing or corrupt vdevs if the `zpool.cache` file is stale or otherwise incorrect. \ No newline at end of file diff --git a/Ubuntu-16.04-Root-on-ZFS.md b/Ubuntu-16.04-Root-on-ZFS.md index 29086ba..4a1f7d2 100644 --- a/Ubuntu-16.04-Root-on-ZFS.md +++ b/Ubuntu-16.04-Root-on-ZFS.md @@ -23,7 +23,7 @@ If you have bugs or feature requests related to this HOWTO, please [file a new i $ sudo apt-add-repository universe $ sudo apt update -1.3 Optional: Install the OpenSSH server in the Live CD environment: +1.3 Optional: Start the OpenSSH server in the Live CD environment: If you have a second system, using SSH to access the target system can be convenient. @@ -119,7 +119,7 @@ With ZFS, it is not normally necessary to use a mount command (either `mount` or # zfs create -o com.sun:auto-snapshot=false \ -o mountpoint=/var/lib/nfs rpool/var/nfs -The primary goal of this dataset layout is to separate the OS (at `rpool/ROOT/ubuntu`) from user data. This allows the root filesystem to be rolled back without rolling back user data such as logs (in `/var/log`). This will be especially important if/when a `beadm` or similar utility is integrated. Since we are creating multiple datasets anyway, it is trivial to add some restrictions (for extra security) at the same time. The `com.sun.auto-snapshot` setting is used by some ZFS snapshot utilities to exclude transient data. +The primary goal of this dataset layout is to separate the OS from user data. This allows the root filesystem to be rolled back without rolling back user data such as logs (in `/var/log`). This will be especially important if/when a `beadm` or similar utility is integrated. Since we are creating multiple datasets anyway, it is trivial to add some restrictions (for extra security) at the same time. The `com.sun.auto-snapshot` setting is used by some ZFS snapshot utilities to exclude transient data. 3.4 Install the minimal system: @@ -127,7 +127,7 @@ The primary goal of this dataset layout is to separate the OS (at `rpool/ROOT/ub # debootstrap xenial /mnt # zfs set devices=off rpool -The `debootstrap` command leaves the new system in an unconfigured state. An alternative to using `debootstrap` is to copy the entirety of a working Ubuntu system into the new ZFS root. +The `debootstrap` command leaves the new system in an unconfigured state. An alternative to using `debootstrap` is to copy the entirety of a working system into the new ZFS root. ## Step 4: System Configuration @@ -165,14 +165,6 @@ Customize this file if the system is not a DHCP client. 4.4 Configure a basic system environment: - # locale-gen en_US.UTF-8 - -Even if you prefer a non-English system language, always ensure that `en_US.UTF-8` is available. - - # echo 'LANG="en_US.UTF-8"' > /etc/default/locale - - # dpkg-reconfigure tzdata - # vi /etc/apt/sources.list deb http://archive.ubuntu.com/ubuntu xenial main universe deb-src http://archive.ubuntu.com/ubuntu xenial main universe @@ -185,6 +177,15 @@ Even if you prefer a non-English system language, always ensure that `en_US.UTF- # ln -s /proc/self/mounts /etc/mtab # apt update + + # locale-gen en_US.UTF-8 + +Even if you prefer a non-English system language, always ensure that `en_US.UTF-8` is available. + + # echo 'LANG="en_US.UTF-8"' > /etc/default/locale + + # dpkg-reconfigure tzdata + # apt install --yes ubuntu-minimal 4.5 Install ZFS in the chroot environment for the new system: diff --git a/Ubuntu-16.10-Root-on-ZFS.md b/Ubuntu-16.10-Root-on-ZFS.md index 7993964..7320916 100644 --- a/Ubuntu-16.10-Root-on-ZFS.md +++ b/Ubuntu-16.10-Root-on-ZFS.md @@ -23,7 +23,7 @@ If you have bugs or feature requests related to this HOWTO, please [file a new i $ sudo apt-add-repository universe $ sudo apt update -1.3 Optional: Install the OpenSSH server in the Live CD environment: +1.3 Optional: Start the OpenSSH server in the Live CD environment: If you have a second system, using SSH to access the target system can be convenient. @@ -117,7 +117,7 @@ With ZFS, it is not normally necessary to use a mount command (either `mount` or # zfs create -o com.sun:auto-snapshot=false \ -o mountpoint=/var/lib/nfs rpool/var/nfs -The primary goal of this dataset layout is to separate the OS (at `rpool/ROOT/ubuntu`) from user data. This allows the root filesystem to be rolled back without rolling back user data such as logs (in `/var/log`). This will be especially important if/when a `beadm` or similar utility is integrated. Since we are creating multiple datasets anyway, it is trivial to add some restrictions (for extra security) at the same time. The `com.sun.auto-snapshot` setting is used by some ZFS snapshot utilities to exclude transient data. +The primary goal of this dataset layout is to separate the OS from user data. This allows the root filesystem to be rolled back without rolling back user data such as logs (in `/var/log`). This will be especially important if/when a `beadm` or similar utility is integrated. Since we are creating multiple datasets anyway, it is trivial to add some restrictions (for extra security) at the same time. The `com.sun.auto-snapshot` setting is used by some ZFS snapshot utilities to exclude transient data. 3.4 Install the minimal system: @@ -125,7 +125,7 @@ The primary goal of this dataset layout is to separate the OS (at `rpool/ROOT/ub # debootstrap yakkety /mnt # zfs set devices=off rpool -The `debootstrap` command leaves the new system in an unconfigured state. An alternative to using `debootstrap` is to copy the entirety of a working Ubuntu system into the new ZFS root. +The `debootstrap` command leaves the new system in an unconfigured state. An alternative to using `debootstrap` is to copy the entirety of a working system into the new ZFS root. ## Step 4: System Configuration @@ -163,14 +163,6 @@ Customize this file if the system is not a DHCP client. 4.4 Configure a basic system environment: - # locale-gen en_US.UTF-8 - -Even if you prefer a non-English system language, always ensure that `en_US.UTF-8` is available. - - # echo 'LANG="en_US.UTF-8"' > /etc/default/locale - - # dpkg-reconfigure tzdata - # vi /etc/apt/sources.list deb http://archive.ubuntu.com/ubuntu yakkety main universe deb-src http://archive.ubuntu.com/ubuntu yakkety main universe @@ -184,6 +176,14 @@ Even if you prefer a non-English system language, always ensure that `en_US.UTF- # ln -s /proc/self/mounts /etc/mtab # apt update + # locale-gen en_US.UTF-8 + +Even if you prefer a non-English system language, always ensure that `en_US.UTF-8` is available. + + # echo 'LANG="en_US.UTF-8"' > /etc/default/locale + + # dpkg-reconfigure tzdata + 4.5 Install ZFS in the chroot environment for the new system: # apt install --yes --no-install-recommends linux-image-generic diff --git a/Ubuntu-17.04-Root-on-ZFS.md b/Ubuntu-17.04-Root-on-ZFS.md index 685710e..e457a7f 100644 --- a/Ubuntu-17.04-Root-on-ZFS.md +++ b/Ubuntu-17.04-Root-on-ZFS.md @@ -38,7 +38,7 @@ If you want encryption, LUKS is recommended. $ sudo apt-add-repository universe $ sudo apt update -1.3 Optional: Install the OpenSSH server in the Live CD environment: +1.3 Optional: Start the OpenSSH server in the Live CD environment: If you have a second system, using SSH to access the target system can be convenient. @@ -132,7 +132,7 @@ With ZFS, it is not normally necessary to use a mount command (either `mount` or # zfs create -o com.sun:auto-snapshot=false \ -o mountpoint=/var/lib/nfs rpool/var/nfs -The primary goal of this dataset layout is to separate the OS (at `rpool/ROOT/ubuntu`) from user data. This allows the root filesystem to be rolled back without rolling back user data such as logs (in `/var/log`). This will be especially important if/when a `beadm` or similar utility is integrated. Since we are creating multiple datasets anyway, it is trivial to add some restrictions (for extra security) at the same time. The `com.sun.auto-snapshot` setting is used by some ZFS snapshot utilities to exclude transient data. +The primary goal of this dataset layout is to separate the OS from user data. This allows the root filesystem to be rolled back without rolling back user data such as logs (in `/var/log`). This will be especially important if/when a `beadm` or similar utility is integrated. Since we are creating multiple datasets anyway, it is trivial to add some restrictions (for extra security) at the same time. The `com.sun.auto-snapshot` setting is used by some ZFS snapshot utilities to exclude transient data. 3.4 Install the minimal system: @@ -140,7 +140,7 @@ The primary goal of this dataset layout is to separate the OS (at `rpool/ROOT/ub # debootstrap zesty /mnt # zfs set devices=off rpool -The `debootstrap` command leaves the new system in an unconfigured state. An alternative to using `debootstrap` is to copy the entirety of a working Ubuntu system into the new ZFS root. +The `debootstrap` command leaves the new system in an unconfigured state. An alternative to using `debootstrap` is to copy the entirety of a working system into the new ZFS root. ## Step 4: System Configuration @@ -178,14 +178,6 @@ Customize this file if the system is not a DHCP client. 4.4 Configure a basic system environment: - # locale-gen en_US.UTF-8 - -Even if you prefer a non-English system language, always ensure that `en_US.UTF-8` is available. - - # echo 'LANG="en_US.UTF-8"' > /etc/default/locale - - # dpkg-reconfigure tzdata - # vi /etc/apt/sources.list deb http://archive.ubuntu.com/ubuntu zesty main universe deb-src http://archive.ubuntu.com/ubuntu zesty main universe @@ -199,6 +191,14 @@ Even if you prefer a non-English system language, always ensure that `en_US.UTF- # ln -s /proc/self/mounts /etc/mtab # apt update + # locale-gen en_US.UTF-8 + +Even if you prefer a non-English system language, always ensure that `en_US.UTF-8` is available. + + # echo 'LANG="en_US.UTF-8"' > /etc/default/locale + + # dpkg-reconfigure tzdata + 4.5 Install ZFS in the chroot environment for the new system: # apt install --yes --no-install-recommends linux-image-generic diff --git a/_Sidebar.md b/_Sidebar.md index d20fb7f..0d79553 100644 --- a/_Sidebar.md +++ b/_Sidebar.md @@ -3,7 +3,7 @@ * [ArchLinux][arch] * [[Debian]] * [Debian initrd Documentation](Debian GNU Linux initrd documentation) - * [Debian Root on ZFS](HOWTO install Debian GNU Linux to a Native ZFS Root Filesystem) + * [Debian Root on ZFS](Debian Jessie Root on ZFS) * [Dual booting OS X and Debian](Dual booting OS X and Debian Jessie with ZFS root, cross mounting and full disk encryption) * [[Fedora]] * [Gentoo][gentoo] @@ -34,4 +34,4 @@ [releases]: https://github.com/zfsonlinux/zfs/releases [issues]: https://github.com/zfsonlinux/zfs/issues [roadmap]: https://github.com/zfsonlinux/zfs/milestones -[openzfs-devel]: http://open-zfs.org/wiki/Developer_resources \ No newline at end of file +[openzfs-devel]: http://open-zfs.org/wiki/Developer_resources