0

I want to move /var from a simple ext4 partition to a zfs pool I've built on a RAID array. I understand I've got to reboot in single user mode to cp -avr the /var partition across, but how do I make sure all of the kernel modules are loaded on boot and in the single user environment, do I have to put them in an initrd?

1
  • I don't know in your exact scenario, but normally the only time you need to worry about modules in initrd is when you're trying to find the root partition. Or wherever the other modules are, e.g. /lib/modules/. Even in single user mode the kernel will pivot to the drive's root partition. Oct 22, 2020 at 21:12

1 Answer 1

0

Solved this (Debian 10);

  • Set up your ZFS structure but not mount points
  • Reboot in single-user mode
  • Import ZFS structure using zpool import -d /dev/disk/by-id
  • Copy /var to new pool, I used rsync -avxHAX /var/
  • Move /var to /var2 as a backup
  • Edit /etc/fstab to prevent mount of old var
  • Change the mount point of your ZFS partition to zfs set mountpoint=/var
  • Reboot

Optional; you might need to "zfs set overlay=on ". I didn't need to do this on a test VM with zfs on a single disk, but did on a crufty old server. This is because the kernel was starting to fill /var before ZFS mounted. looking at the systemd log, this was about the same point in the boot as my old ext4 partition got mounted over /var and the system works, but ymmv.

Rationale; I wanted more space for my docker containers and VMs and them to be in the standard location on the filesystem and I wanted to try ZFS for the snapshotting, compression and stability. I'll update this if it goes horribly wrong.

1
  • I can't see what your rsync target is. rsync -avxHAX /var/ . . . to where? Can you copy files to a pool that isn't mounted?
    – user189395
    Apr 13 at 0:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.