Moving Home to LVM

Hi all,

Just installed Garuda Gnome.

I've created an LVM spanning two 8TB drives, and I want this to be my /home partition. Having issues getting the fstab to have the correct settings.

lvdisplay shows the following:

--- Logical volume ---
LV Path /dev/big/bigger
LV Name bigger
VG Name big
LV UUID 2IYYCd-HYXi-gFZj-3E5I-I8tJ-tQoQ-pOB3gG
LV Write Access read/write
LV Creation host, time garuda, 2021-07-07 20:03:59 -0500
LV Status available

open 1

LV Size 14.55 TiB
Current LE 3814196
Segments 2
Allocation inherit
Read ahead sectors auto

  • currently set to 256
    Block device 253:0

Here is what the installer put in (does work but on wrong drive):

UUID=015f1d90-7f77-4a21-86dc-f730b2e0d9c2 /home btrfs subvol=/@home,defaults,noatime,space_cache,autodefrag,compress=zstd 0 2

In /etc/fstab I've tried the following which don't work:

UUID=2IYYCd-HYXi-gFZj-3E5I-I8tJ-tQoQ-pOB3gG /home btrfs subvol=/@home,defaults,noatime,space_cache,autodefrag,compress=zstd 0 2

/dev/big/bigger /home btrfs subvol=/@home,defaults,noatime,space_cache,autodefrag,compress=zstd 0 2

(of course when I try them individually I add / remove the # as needed. )

If anyone can assist me with what I need to put in that would be much appreciated. I've used:
/dev/big/bigger /home btrfs
in Ubuntu before and it worked, not sure what the issue is here.

Thanks for the help!

Chris

Did you validate that the device /dev/big/bigger exists?

Does /dev/big/bigger have a btrfs filesystem with a subvolume @home on it?

I would start by manually mounting the root of /dev/big/bigger and making sure that can be mounted. Then validate the subvol inside is correct

Yes, the following works just fine:

sudo mount /dev/big/bigger /home2

What does this return

sudo btrfs subvolume list /home2

It doesn't return anything:

╭─[email protected] in ~ took 4s
╰─λ sudo btrfs subvolume list /home2
[sudo] password for chris:

╭─[email protected] in ~ took 5s

That means you haven't migrated your @home subvolume there which explains why you are failing to mount it. It doesn't exist.

There are a couple of ways to solve this.

You can easily use snapshots and btrfs-send/btrfs-receive to migrate the existing @home subvol to the other drive.

Alternatively, you can create the @home subvol and manually migrate the data with rsync.

If you need instructions on how to do either of those let me know which you prefer. Although, you will have to wait 60 minutes or so since I will be away from my PC for a bit.

EDIT: Alternatively, if you already migrated the data a different way, then please share what you did.

4 Likes

Thanks Dalto,

I had previously tried to just cp /home/chris to /home2/home/chris however if I need to do it again that wouldn't be an issue. I'll wait for you to get back to me as to how to use btrfs-send/btrfs-receive I did find https://blogs.oracle.com/linux/post/btrfs-sendreceive-helps-to-move-and-backup-your-data but would rather not mess it up.

Thanks for the help!

Kat

This puts you home directory at the root of the btrfs volume. If that is what you want, then all you need to do is remove the [email protected] from /etc/fstab. Something like this:

/dev/big/bigger /home btrfs defaults,noatime,space_cache,autodefrag,compress=zstd 0 2

If you would rather send a snaopshot over, let me know.

I tried adding this:

/dev/big/bigger /home btrfs defaults,noatime,space_cache,autodefrag,compress=zstd 0 2

But I wasn't able to get past the login screen.

So I guess should use btrfs-send/btrfs-receive

First remount the root of /dev/big/bigger at /home2 again then it should be something like this:

sudo btrfs subvolume snapshot -r /home /home/transferhome
sudo btrfs send /home/transferhome  | sudo btrfs receive /home2
sudo btrfs subvolume snapshot /home2/transferhome /home2/@home

I didn't test that but I am pretty sure that is right. Either way, it should be non-destructive.

Don't forget to add the [email protected] back into /etc/fstab

Once that is done and working and you have tested it you can delete all the subvols you don't need anymore.

Thanks Dalto, this did the trick.

How do I remove the contents of the old /home ?

First of all, this is destructive so make sure you have the right things mounted or you could delete the wrong data. A backup is always a good plan as well.

To delete the subvolume you used to transfer, fist remount the root of /dev/big/bigger at /home2 again

sudo btrfs subvolume delete /home2/transferhome
sudo umount /home2

Next you need to mount the root of the original disk(the one that held the old @home subvol you don't need anymore) somewhere if it isn't mounted already. It probably isn't mounted so I am going to assume you mounted it at /mnt/oldhome

Once it is mounted, you can delete the other copy of transfer snapshot and the original subvolume.

sudo btrfs subvolume delete /mnt/oldhome/@home/transferhome
sudo btrfs subvolume delete /mnt/oldhome/@home

Again, be careful here as you are deleting data.

2 Likes

How would I mount the oldhome? It was part of the same drive that / is on

Can you share sudo btrfs subvolume list /

2 Likes
ID 256 gen 1532 top level 5 path @
ID 257 gen 1436 top level 5 path @home
ID 258 gen 1424 top level 5 path @root
ID 259 gen 35 top level 5 path @srv
ID 260 gen 1526 top level 5 path @cache
ID 261 gen 1532 top level 5 path @log
ID 262 gen 1520 top level 5 path @tmp
ID 272 gen 46 top level 5 path timeshift-btrfs/snapshots/2021-07-07_19-38-57/@
ID 292 gen 1426 top level 257 path @home/transferhome

sudo mkdir -p /mnt/oldhome
sudo mount -t btrfs UUID=015f1d90-7f77-4a21-86dc-f730b2e0d9c2 /mnt/oldhome

Now, if you did that correctly then when you do an ls /mnt/oldhome you should see @root and all that other stuff. Than you can do

sudo btrfs subvolume delete /mnt/oldhome/@home/transferhome
sudo btrfs subvolume delete /mnt/oldhome/@home
2 Likes

thanks! I think this issue is all set now :smile:

1 Like

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.