You are not logged in.

#1 2014-02-06 10:14:01

StR@ng3r
Member
Registered: 2011-11-12
Posts: 65

Install on btrfs with subvolumes?

Hello folks,

can someone please explain to me how I would go about correctly installing arch on btrfs using subvolumes? I would like to set up subvolumes for / and /home to be able to quickly make a snapshot of either one of them, should I feel like it. Are there any more subvolumes that would make sense to create? /boot is on a seperate partition.

Assuming I have formated sda2 as btrfs. I would then proceed to mount /dev/sda2 to /mnt.

Now what exactly do I do next? I am thinking, btrfs subvolume create @ to create my subvolume for /. Then what? How do I create the subvolume for /home? Right there? Or do I unmount /dev/sda2 first and remount the newly created subvolume @ in oder to create just another subvolume called @home inside?

After all that. how do I mount that stuff?

mount -o subvol=@ /dev/sda2 /mnt followed by mkdir /mnt/home and mount -o subvol=@home /dev/sda2 /mnt/home ?

Would that be the way to go about this?

Thank you very much fur your help.

PS: On a side note, I got 16G of RAM. Since I cannot use a swap file on btrfs. Should I still create a swap partition or just let it go since it is a SSD and I don't need hybernation in the first place?

Offline

#2 2014-02-06 11:02:24

WorMzy
Administrator
From: Scotland
Registered: 2010-06-16
Posts: 12,373
Website

Re: Install on btrfs with subvolumes?

can someone please explain to me how I would go about correctly installing arch on btrfs using subvolumes?

Mount the subvolumes in the way you think is best, then run pacstrap to install the system. How you should lay your system out is not for us to decide. This is your system, and you know your requirements better than anyone.

On my latest system, I have my system set up like so:

$ cat /etc/fstab
UUID=d9ab8768-d9c4-41e3-8fab-12ac9a687f30 /                     btrfs rw,relatime,space_cache,subvol=root     0 0
UUID=d9ab8768-d9c4-41e3-8fab-12ac9a687f30 /home/wormzy          btrfs rw,relatime,space_cache,subvol=wormzy   0 0
UUID=d9ab8768-d9c4-41e3-8fab-12ac9a687f30 /var/lib/btrfs-root   btrfs rw,relatime,space_cache                 0 0
UUID=8ced499d-e124-4e0f-9675-4c92fcbb3518 /media/storage        btrfs rw,relatime,space_cache                 0 0
UUID=8ced499d-e124-4e0f-9675-4c92fcbb3518 /home/wormzy/builds   btrfs rw,relatime,space_cache,subvol=builds   0 0
UUID=8ced499d-e124-4e0f-9675-4c92fcbb3518 /var/cache/pacman/pkg btrfs rw,relatime,space_cache,subvol=pkgcache 0 0
UUID=8ced499d-e124-4e0f-9675-4c92fcbb3518 /home/wormzy/Pictures btrfs rw,relatime,space_cache,subvol=pictures 0 0
UUID=8ced499d-e124-4e0f-9675-4c92fcbb3518 /home/wormzy/projects btrfs rw,relatime,space_cache,subvol=projects 0 0
UUID=8ced499d-e124-4e0f-9675-4c92fcbb3518 /var/lib/archbuild    btrfs rw,relatime,space_cache,subvol=chroots  0 0
UUID=c9a0976c-e2c1-4f2a-86c9-1d543ce6229f /boot                  ext4 defaults                                0 2

$ ls /var/lib/btrfs-root
root  root-20130115  wt575

I haven't bothered with swap on any of my desktop systems.

One thing I'll point out though, is that you should unmount sda2 from /mnt before you mount your root subvolume there. It might confuse genfstab otherwise (you would effectively have two filesystems mounted at /)


Sakura:-
Mobo: MSI MAG X570S TORPEDO MAX // Processor: AMD Ryzen 9 5950X @4.9GHz // GFX: AMD Radeon RX 5700 XT // RAM: 32GB (4x 8GB) Corsair DDR4 (@ 3000MHz) // Storage: 1x 3TB HDD, 6x 1TB SSD, 2x 120GB SSD, 1x 275GB M2 SSD

Making lemonade from lemons since 2015.

Offline

#3 2014-02-06 11:31:36

frostbittenking
Member
Registered: 2013-05-01
Posts: 54

Re: Install on btrfs with subvolumes?

He has the same problem that I had. I couldn't find out what's the preferred way for subvolumes. Either a subvolume inside the root subvolume: something like: root and root/home -> nested subvolumes, or both as "siblings, with a common ancestor":
in the root folder: (@, @home, etc) and later mount them in /mnt:

mount .... -o subvol=@ /mnt
mount ... -o subvol=@home /mnt/home

.
In the end, I did the latter, because nested subvolumes, eg. in @ a boot subvol .. @/boot is kinda confusing to grub. I was able to boot it in the end, but it kinda defeated the purpose because I had to explicitly mount @/boot in @ as subvolume in /etc/fstab, or else I couldn't boot it. I thought I need not to list @/boot in fstab since it is a nested subvolume inside @ anyway, and if you mount @, you can access @/boot anyway.
-> all subvolumes as siblings, due to its less confusing nature with regards to subvols.

Offline

#4 2014-02-07 03:34:28

grandtheftjiujitsu
Member
Registered: 2013-07-27
Posts: 91

Re: Install on btrfs with subvolumes?

I've been using btrfs for a few months now with different (re)installs.  I set up my laptop with three partitions:  one for /boot, one for / (and @), and one for /home (and @home).  While installing, after making the filesystems, I did something like this...

mount -t btrfs /dev/sdX /mnt
btrfs subvolume create /mnt/@
umount /mnt
mount -t btrfs /dev/sdY /mnt
btrfs subvolume create /mnt/@home
umount /mnt
mount -t btrfs -o subvol=@ /dev/sdX /mnt
mkdir /mnt/home /mnt/boot
mount -t btrfs -o subvol=@home dev/sdY /mnt/home
mount /dev/sdZ /mnt/boot 

I also have a persistent USB that only has one partition for both / and /home; in which case they are "siblings" (e.g.:  @ and @home are both subvolumes on /dev/sdX).  /boot is still on a separate partition.

 mount -t btrfs /dev/sdX /mnt
btrfs subvolume create /mnt/@
btrfs subvolume create /mnt/@home
umount /mnt
mount -t btrfs -o subvol=@ /dev/sdX /mnt
mkdir /mnt/home /mnt/boot
mopunt -t btrfs -o subvol=@home /dev/sdX /mnt/home
mount /dev/sdY /mnt/boot 

I would say that you're good without a swap, unless you're using all of that memory.  As far as snapshots, they're pretty handy (especially in conjunction with cron), just remember they're not replacements for proper backups.

Last edited by grandtheftjiujitsu (2014-02-07 03:43:50)

Offline

#5 2014-02-07 06:33:18

StR@ng3r
Member
Registered: 2011-11-12
Posts: 65

Re: Install on btrfs with subvolumes?

Thank you guys. This really helps.

I am gonna go with the siblings aproach on this.

Last edited by StR@ng3r (2014-02-07 06:34:02)

Offline

#6 2014-02-07 10:35:21

frostbittenking
Member
Registered: 2013-05-01
Posts: 54

Re: Install on btrfs with subvolumes?

Another thing I forgot. For /boot, better use a traditional partition with ext2/3. It works having /boot on a btrfs subvolume, but getting it installed and booting is a bit dodgy. I tried that when I moved my system to a new harddrive, since the old one was starting to give me read errors (fortunately, on a partition where I only had stored some stuff that wasn't important-> not the system partitions). Had to boot 2 or 3 times with a live system and chroot into the actual system, to reinstall grub, because ..as I said, it is kinda dodgy and didn't boot in the beginning. It always stopped booting, because the root fs wasn't found (blah device with uuid blah wasn't found .. you stupid idiot, you just loaded the grub config from that device).

Offline

#7 2014-02-09 01:09:22

jayflo
Member
Registered: 2013-09-06
Posts: 33

Re: Install on btrfs with subvolumes?

Offline

Board footer

Powered by FluxBB