The officially official Devuan Forum!

You are not logged in.

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

Cosque
Member
Registered: 2018-06-15
Posts: 10  

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)

Offline

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

specing
Member
Registered: 2019-02-12
Posts: 16  

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 5 GB or so) # mkfs.btrfs -f /dev/vg_devuan/main
- # mkdir /rv
- # mount -o noatime,compress=lzo,nossd,autodefrag,space_cache=v2 /dev/vg_devuan/main /rv
- # btrfs subvol create /rv/devuan/root.subvol
- # mount -o noatime,compress=lzo,nossd,autodefrag,subvol=/devuan/root.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.

EDIT 2020.05.10: Changed 16GB->5GB to be in line with btrfs recommendations. Added space_cache=v2. Changed rootfs.subvol to just root.subvol
Note: if you get stuck on the first boot, ctrl-c will unstuck it and land you at login. If you further cannot remount / rw, then also specify the device on the command line. Seems to happen if no lvm/luks is used, as the above reformat step will change UUID.

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

Last edited by specing (2020-05-10 14:34:21)

Offline

#3 2020-01-11 16:11:07

waynedpj
Member
Registered: 2019-02-26
Posts: 11  
Website

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

ahoy specing,

  thanks for the detailed tutorial on getting Btrfs+subvolumes installed.  i am trying to use an existing Btrfs partition and subvolumes (described in more detail here https://dev1galaxy.org/viewtopic.php?pid=19401#p19401) but am having problems with the step

Choose expert install, proceed up to and including partitioning. Finish partitioning normally, choosing luks,lvm,btrfs or whatever.

when i get to the partitioning step in the netinst expert mode installer, i cannot find a way to select a root partition that allows that step to complete without (seemingly) the installer overwriting my Btrfs partition.  my disk only has 2 partitions:

/dev/sda1    GRUB BIOS boot partition (for booting GPT disk with BIOS)
/dev/sda2    LUKS1 dm encrypted Btrfs partition (remainder of disk)

  thus has something changed in the latest installer for ASCII stable 2.1 that changes your instructions?  or am i missing some simple step implied in your tutorial (this is my first experience with the Debian/Devuan installer)?

thanks again for your help, w

Offline

#4 2020-01-11 20:21:44

Head_on_a_Stick
Member
From: London
Registered: 2019-03-24
Posts: 3,125  
Website

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

I just install a standard system, back it up then create the subvolume layout as desired and rsync the backup to the new layout.

The fstab and bootloader need correcting afterwards but it works:

empty@E485:~ $ grep '/ ' /proc/self/mounts                                               
/dev/nvme0n1p3 / btrfs rw,relatime,ssd,space_cache,subvolid=257,subvol=/debian 0 0
empty@E485:~ $

Brianna Ghey — Rest In Power

Offline

#5 2020-01-12 04:23:17

waynedpj
Member
Registered: 2019-02-26
Posts: 11  
Website

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

Head_on_a_Stick wrote:

I just install a standard system, back it up then create the subvolume layout as desired and rsync the backup to the new layout.

The fstab and bootloader need correcting afterwards but it works:

empty@E485:~ $ grep '/ ' /proc/self/mounts                                               
/dev/nvme0n1p3 / btrfs rw,relatime,ssd,space_cache,subvolid=257,subvol=/debian 0 0
empty@E485:~ $

thank you, i was considering this too.  however unfortunately in this HDD i do not have any extra partitions to which i can do a temp install.  though can we install to an external USB partition?

also i am still hoping for something a little less convoluted wink

thanks again, w

Offline

#6 2020-01-12 11:15:30

Head_on_a_Stick
Member
From: London
Registered: 2019-03-24
Posts: 3,125  
Website

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

waynedpj wrote:

unfortunately in this HDD i do not have any extra partitions to which i can do a temp install.  though can we install to an external USB partition?

Install to the HDD and use the USB to hold the backup, that's what I do.


Brianna Ghey — Rest In Power

Offline

#7 2020-01-13 15:39:16

waynedpj
Member
Registered: 2019-02-26
Posts: 11  
Website

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

Head_on_a_Stick wrote:
waynedpj wrote:

unfortunately in this HDD i do not have any extra partitions to which i can do a temp install.  though can we install to an external USB partition?

Install to the HDD and use the USB to hold the backup, that's what I do.

thanks again, maybe i will end up having to do this if neither installer can be made to work with Btrfs subvolumes.  so you just rsync everything from / and /home to the respective subvolumes?  and i assume then update fstab, cryptab, and GRUB?

thanks, w

Offline

#8 2020-01-13 15:44:33

Head_on_a_Stick
Member
From: London
Registered: 2019-03-24
Posts: 3,125  
Website

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

waynedpj wrote:

so you just rsync everything from / and /home to the respective subvolumes?

Yes, I use this method to create a full backup then reverse the process when the subvolumes are created and mounted as desired.

waynedpj wrote:

and i assume then update fstab, cryptab, and GRUB?

I don't use encryption[1] so just the fstab and bootloader need correcting. I use a custom grub.cfg but grub-mkconfig can deal with subvolumes and appears to create a working configuration file.

[1] I don't keep anything important on computers and in my country (the UK) I can go to jail if the Police want to see what's on it and I can't remember the password.


Brianna Ghey — Rest In Power

Offline

#9 2020-01-15 05:21:57

waynedpj
Member
Registered: 2019-02-26
Posts: 11  
Website

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

Head_on_a_Stick wrote:

Yes, I use this method to create a full backup then reverse the process when the subvolumes are created and mounted as desired.

thanks, handy method, nice and simple.

Head_on_a_Stick wrote:
waynedpj wrote:

and i assume then update fstab, cryptab, and GRUB?

I don't use encryption[1] so just the fstab and bootloader need correcting. I use a custom grub.cfg but grub-mkconfig can deal with subvolumes and appears to create a working configuration file.

unfortunately thus far with the refractainstaller it seems like something GRUB-related is not working as it is not opening the encrypted partition and finding the initramfs even though it accesses the encrypted /boot (details https://dev1galaxy.org/viewtopic.php?pid=19493#p19493).

Head_on_a_Stick wrote:

[1] I don't keep anything important on computers and in my country (the UK) I can go to jail if the Police want to see what's on it and I can't remember the password.

i imagine that unfortunately this can happen in pretty much any country no matter what the law says wink

thanks again, w

Offline

#10 2020-01-20 18:34:18

waynedpj
Member
Registered: 2019-02-26
Posts: 11  
Website

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

unfortunately thus far with the refractainstaller it seems like something GRUB-related is not working as it is not opening the encrypted partition and finding the initramfs even though it accesses the encrypted /boot (details https://dev1galaxy.org/viewtopic.php?pid=19493#p19493).

just to update this thread: i was able to get Devuan installed to my existing encrypted partition with Btrfs subvolumes, details in my thread https://dev1galaxy.org/viewtopic.php?pid=19578#p19578.  thanks again for the help here.

peace, w

Offline

#11 2020-05-10 10:45:49

specing
Member
Registered: 2019-02-12
Posts: 16  

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

waynedpj wrote:

...

Cool. My instructions were for making an entirely new install, I have not yet concerned myself with multiple distros on same btrfs (outside LXC).

If the installer does not let you proceed without creating anything on disk, then my first reaction would be to give it a USB stick or another disk (easy with qemu) to play on. Then change /target before starting installation.

Last edited by specing (2020-05-10 10:47:07)

Offline

Board footer