The officially official Devuan Forum!

You are not logged in.

#1 2018-06-21 21:45:12

Registered: 2018-06-15
Posts: 9  

How to install Devuan in BTRFS partition with subvolumes @ and @home ?

Hello, thanks for your time!

I want to install Devuan on a BTRFS partition with subvolumes "@" and "@home"
What are the steps? With which "iso"?

any ideas?

Last edited by Cosque (2018-06-24 17:03:01)


#2 2019-02-19 03:10:42

Registered: 2019-02-12
Posts: 4  

Re: How to install Devuan in BTRFS partition with subvolumes @ and @home ?

I don't like the @ naming convention for subvolumes as the @ has to be escaped in shell. Instead I give these directories the .subvol extension.

Choose expert install, proceed up to and including partitioning. Finish partitioning normally, choosing luks,lvm,btrfs or whatever. Then:
- go to another terminal (alt+f2)
- find the btrfs filesystem device in output of # mount   (in my case it is at /dev/vg_devuan/main)
- # mkdir /tmp/target
- # cp -ar /target/* /tmp/target
- # umount /target
- (Add --mixed if device is under 16 GB or so) # mkfs.btrfs -f /dev/vg_devuan/main
- # mkdir /rv
- # mount -o noatime,compress=lzo,nossd,autodefrag /dev/vg_devuan/main /rv
- # btrfs subvol create /rv/devuan/rootfs.subvol
- # mount -o noatime,compress=lzo,nossd,autodefrag,subvol=/devuan/rootfs.subvol /dev/path/to/btrfs/device /target
- # cp -ar /tmp/target/* /target
- (optional, if you are low on RAM) # rm -r /tmp/target

Now go back to the installer and proceed at the "Install base system" step.

Disregard the above, it results in the "Install base system" hitting
"Error: apt or in-target already running" and I do not know how to resolve it.
So, just complete the install normally, without compression or subvolumes,
we'll deal with that later.
This is does not happen any more.

Complete the install and reboot. When it reboots, login as root only and do the following:
- # mkdir /rv
Edit /etc/fstab, and change it to resemble the following (Note: the nossd flag is there because the ssd allocator has some issues on kernels <4.15 or some such):

 /etc/fstab: static file system information.
# Use 'blkid' to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name devices
# that works even if disks are added and removed. See fstab(5).
# <file system>            <mount point>   <type>  <options>       <dump>  <pass>
/dev/mapper/vg_devuan-main /               btrfs   defaults,nossd,compress=lzo,noatime,subvol=/devuan/root.subvol 0 0
/dev/mapper/vg_devuan-main /home           btrfs   defaults,nossd,compress=lzo,noatime,subvol=/devuan/home.subvol 0 0
/dev/mapper/vg_devuan-main /rv             btrfs   defaults,nossd,compress=lzo,noatime,subvolid=5                 0 0

tmpfs                      /tmp            tmpfs   defaults                                                       0 0

/dev/sr0                   /media/cdrom0   udf,iso9660 user,noauto                                                0 0

The /tmp line is optional.

- # mount /rv
- # btrfs subvol create /rv/devuan/home.subvol
- # cp -ar --reflink=always /rv/devuan/root.subvol/home/* /rv/devuan/home.subvol
Remember the --reflink=always parameter, it makes cp do a shallow copy on btrfs (same files underneath, copy on change). You might want to put that into bashrc as an alias: alias cpref="cp --reflink=always.
- # rm -r /home/*
- # mount /home

Reboot for the new mount flags to take to effect. Now it should work as intended and the output of # mount  should reflect that.

I will amend this post with further fixes, should any problems arise.

Last edited by specing (2019-02-20 20:49:20)


Board footer