Ubuntu on a zfs root file system for ubuntu 14 04
wordpress meta
title: 'Ubuntu On a ZFS Root File System for Ubuntu 14.04'
date: '2014-06-05T09:29:01-05:00'
status: publish
permalink: /ubuntu-on-a-zfs-root-file-system-for-ubuntu-14-04
author: admin
excerpt: ''
type: post
id: 679
category:
- Ubuntu
- ZFS
tag: []
post_format: []
title: 'Ubuntu On a ZFS Root File System for Ubuntu 14.04'
date: '2014-06-05T09:29:01-05:00'
status: publish
permalink: /ubuntu-on-a-zfs-root-file-system-for-ubuntu-14-04
author: admin
excerpt: ''
type: post
id: 679
category:
- Ubuntu
- ZFS
tag: []
post_format: []
This is an update post to making an Ubuntu 14.04 (Trusty Tahr) OS work with ZFS root volume. Mostly the instructions remains the same as a previous post so this is a shortened version:
http://blog.ls-al.com/booting-ubuntu-on-a-zfs-root-file-system/
Small warning I did this 4 times. It worked the first time but of course I did not document it well the first time and when I tried again I had grub issues.
Step 1:
$ sudo -i
# apt-add-repository --yes ppa:zfs-native/stable
** Don't need grub ppa as per github instructions???
# apt-get update
# apt-get install debootstrap ubuntu-zfs
** Will take quite a while kernel modules compiles!!
# modprobe zfs
# dmesg | grep ZFS:
[ 1327.346821] ZFS: Loaded module v0.6.2-2~trusty, ZFS pool version 5000, ZFS filesystem version 5
Step 2:
# ls /dev/disk/by-id
ata-VBOX_HARDDISK_VBb4fe25f7-8f14d419
ata-VBOX_HARDDISK_VBb4fe25f7-8f14d419-part1
ata-VBOX_HARDDISK_VBb4fe25f7-8f14d419-part2
# fdisk /dev/disk/by-id/ata-VBOX_HARDDISK_VBb4fe25f7-8f14d419
** Make partitions as follow
# fdisk -l /dev/disk/by-id/ata-VBOX_HARDDISK_VBb4fe25f7-8f14d419
Device Boot Start End Blocks Id System
/dev/disk/by-id/ata-VBOX_HARDDISK_VBb4fe25f7-8f14d419-part1 * 2048 206847 102400 be Solaris boot
/dev/disk/by-id/ata-VBOX_HARDDISK_VBb4fe25f7-8f14d419-part2 206848 16777215 8285184 bf Solaris
Step 3:
# mke2fs -m 0 -L /boot/grub -j /dev/disk/by-id/ata-VBOX_HARDDISK_VBb4fe25f7-8f14d419-part1
# zpool create -o ashift=9 rpool /dev/disk/by-id/ata-VBOX_HARDDISK_VBb4fe25f7-8f14d419-part2
# zpool list
NAME SIZE ALLOC FREE CAP DEDUP HEALTH ALTROOT
rpool 7.88G 117K 7.87G 0% 1.00x ONLINE -
# zfs create rpool/ROOT
# zfs create rpool/ROOT/ubuntu-1
# zfs umount -a
# zfs set mountpoint=/ rpool/ROOT/ubuntu-1
# zpool export rpool
Step 4:
# zpool import -d /dev/disk/by-id -R /mnt rpool
# mkdir -p /mnt/boot/grub
# mount /dev/disk/by-id/scsi-SATA_disk1-part1 /mnt/boot/grub
# debootstrap trusty /mnt
WTF: ** System seems hung. I see on a different terminal there was a messages system restart required. Weird. If you get this after debootstrap you have to redo Step 1 and Step 4.1 then...Is this because of only 2G RAM?
Step 5:
# cp /etc/hostname /mnt/etc/
# cp /etc/hosts /mnt/etc/
# tail -1 /mnt/etc/fstab
/dev/disk/by-id/ata-VBOX_HARDDISK_VBb4fe25f7-8f14d419-part1 /boot/grub auto defaults 0 1
# mount --bind /dev /mnt/dev
# mount --bind /proc /mnt/proc
# mount --bind /sys /mnt/sys
# chroot /mnt /bin/bash --login
# locale-gen en_US.UTF-8
# apt-get update
# apt-get install ubuntu-minimal software-properties-common
# apt-add-repository --yes ppa:zfs-native/stable
# apt-add-repository --yes ppa:zfs-native/grub < - See below note on this command
# apt-get update
# apt-get install --no-install-recommends linux-image-generic linux-headers-generic
# apt-get install ubuntu-zfs
# apt-get install grub2-common grub-pc
Quick note on grub issues. During the install I had to create soft links since I could not figure out the grub-probe failures. From memory I think I created soft links as follow and purged grub2-common grub-pc and re-installed:
/dev/disk/by-id/ata-VBOX_HARDDISK_VBb4fe25f7-8f14d419 >>>> /dev/ata-VBOX_HARDDISK_VBb4fe25f7-8f14d419
/dev/disk/by-id/ata-VBOX_HARDDISK_VBb4fe25f7-8f14d419-part1 >>>> /dev/ata-VBOX_HARDDISK_VBb4fe25f7-8f14d419-part1
/dev/disk/by-id/ata-VBOX_HARDDISK_VBb4fe25f7-8f14d419-part2 >>>> /dev/ata-VBOX_HARDDISK_VBb4fe25f7-8f14d419-part2
Update 5.6.14: After I had time to look at it closer I see my grub issues all came from the fact that there is no trusty grub ppa and the apt-add-repository command above is setting up a trusty repo. Quickest way to fix this is after the apt-add-repository --yes ppa:zfs-native/grub command fix the file manually to use raring. As follow:
# more /etc/apt/sources.list.d/zfs-native-grub-trusty.list
deb http://ppa.launchpad.net/zfs-native/grub/ubuntu raring main
Now ready to continue on.
# apt-get install zfs-initramfs
# apt-get dist-upgrade
# passwd root
Step 6:
# grub-probe /
zfs
# ls /boot/grub/i386-pc/zfs*
/boot/grub/i386-pc/zfs.mod /boot/grub/i386-pc/zfsinfo.mod
# update-initramfs -c -k all
update-initramfs: Generating /boot/initrd.img-3.13.0-24-generic
# grep "boot=zfs" /boot/grub/grub.cfg
linux /ROOT/ubuntu-1@/boot/vmlinuz-3.13.0-24-generic root=ZFS=rpool/ROOT/ubuntu-1 ro boot=zfs
linux /ROOT/ubuntu-1@/boot/vmlinuz-3.13.0-24-generic root=ZFS=rpool/ROOT/ubuntu-1 ro boot=zfs
# grep zfs /etc/default/grub
GRUB_CMDLINE_LINUX_DEFAULT="boot=zfs"
# update-grub
# grub-install $(readlink -f /dev/disk/by-id/ata-VBOX_HARDDISK_VBb4fe25f7-8f14d419)
Installation finished. No error reported.
# exit
Step 7:
# umount /mnt/boot/grub
# umount /mnt/dev
# umount /mnt/proc
# umount /mnt/sys
# zfs umount -a
# zpool export rpool
# reboot
Post First Reboot:
- Made a VB snapshot of course
- apt-get install ubuntu-desktop
** grub issues again so I remade the link again. Later fixed with the grub ppa repo pointing to raring instead.
- create a user
- install VB Guest Additions
TODO:
- Check into grub issue and having to create soft links. Something to do with grub not following soft links.