rageek

A place for Unix Thoughts and Ideas

ZFS on Linux emergency Boot CD

If you are planning on running your Linux system on a ZFS root, having an emergency boot CD is indispensable.

I was able to get a SystemRescueCD which already had the proper ZFS modules already included

http://ftp.osuosl.org/pub/funtoo/distfiles/sysresccd/

The image can easily be imaged onto a usb drive for convenience.

Alternatively, in a pinch you can use an Ubuntu Live Image as a base to add the ZFS repos and apt-get all the modules.

What I have done for managing ZFS related boot issues:

1. Boot up (use graphical environment or configure the network and change root password for ssh)
2. Import the root pool and setup a chroot environment

mkdir /mnt/ubuntu
zpool import -f -R /mnt/ubuntu rpool
for dir in sys proc dev; do mount –bind /$dir /mnt/ubuntu/$dir; done
chroot /mnt/ubuntu bash -l

3. after this you can run your grub commands to reinstall to your devices and regenerate your grub.cfg. Additionally, you can stop and restart the udevadmin process if you need to recreate devices in /dev for grub.

4.When you are done, exit from your chroot environment and unmount the filesystem to allow you to export the zfs pool prior to rebooting the system.

for dir in sys proc dev; do umount /mnt/ubuntu/$dir; done
zpool export rpool

Advertisements

2 responses to “ZFS on Linux emergency Boot CD

  1. HarusKG August 20, 2015 at 12:33 pm

    zpool -f -R /mnt/ubuntu rpool # not correct
    zpool import -f -R /mnt/ubuntu rpool #correct

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: