Move BTRFS @home subvolume to hdd

Hey guys, I just reinstalled EndeavourOS with BTRFS and I was having the hardest time trying to setup the subvolumes using the guide for it, so I ended up just using the defaults in Calamares. I’m trying to move my @home volume off of my ssd to my 1tb hdd, how do I go about doing this?

  • Format the new partition to btrfs
  • take a read-only snapshot
  • use btrfs send/btrfs receive to send the data to the other partition
  • Take a read/write snapshot
  • Update /etc/fstab to point to the new location
  • Remount /home
  • Once it is all working, delete the old subvolumes/snapshots

That being said, I don’t think you should do that if your other drive is an SSD. There are bunch of files in /home that will benefit from the faster performance of your SSD. Instead, I would create subvolumes on the new partition for things like Documents, Downloads, Videos, Music and so on. Then mount those subvolumes at the appropriate locations. That way your data will be on the HDD but the rest of /home will be on the SSD.

1 Like

I would keep everything on one drive, but the ssd is very small in comparison to the hdd (the ssd is just merely 256GB while the hdd is 1TB)

I am not advocating for keeping it all on one drive. I am recommending you keep the root of /home/username on that drive and put all the subfolders which are big data consumers like Videos, Downloads, Documents and so on on the HDD.

Ah ok. I might do that, but it just seems alot harder to get setup (especially as I have several folders that contain large amount of data that are directly in the home folder in order to distinguish them from my other data, i.e. my rclone mount partitions and my dedicated gaming folder).

Uh… how do I perform all of these? I’m inside the live install atm and I got the new partition set to btrfs but I have no idea on how to do the rest of the steps inside the live install

Welp, I tried following this for setting up the snapshots… but that just completely broke the system, I moved the file over and all with the snapshot command, and changed the uuid for fstab.

Can we see the contents of /etc/fstab and the output of:

lsblk -o name,type,fstype,size,mountpoint,uuid

Oh wait… question, do I do all of this while the system is booted? I just noticed that the contents are inside ‘@home’ oddly. Also, do I need need to create a folder inside the mount before copying the snapshot to the new disk?

Everything except remounting /home should be able to be done while the system is running. Technically, if you logged and then logged into a TTY as root you could also remount /home on a running system.

It sounds like you setup the mounts wrong. If you share the lsblk command I mentioned above that would help.

Not usually.

Sorry for the delay, I wasn’t logged into the desktop originally

–edit-- Just realized that that’s the fstab for for the liveuser im inside of, not the actual computer

So you want something like this:

sudo mkdir /mnt/old
sudo mkdir /mnt/new
sudo mount /dev/sda2 /mnt/old -o subvolid=5
sudo mount /dev/sdb1 /mnt/new -o subvolid=5

Now, you need to find your home subvol using btrfs, you can see all the subvols with:

sudo btrfs subvolume list /mnt/old
sudo btrfs subvolume list /mnt/new

If you share the output of those last commands we should be able to you fix it.

# <file system>             <mount point>  <type>  <options>  <dump>  <pass>
UUID=468A-91CC                            /boot/efi      vfat    umask=0077 0 2
UUID=2087d075-d2fa-4021-ac77-76006233748e /              btrfs   subvol=/@,defaults,noatime,space_cache,autodefrag,compress=lzo 0 1
UUID=2087d075-d2fa-4021-ac77-76006233748e /home          btrfs   subvol=/@home,defaults,noatime,space_cache,autodefrag,compress=lzo 0 2
UUID=2087d075-d2fa-4021-ac77-76006233748e /var/cache     btrfs   subvol=/@cache,defaults,noatime,space_cache,autodefrag,compress=lzo 0 2
UUID=2087d075-d2fa-4021-ac77-76006233748e /var/log       btrfs   subvol=/@log,defaults,noatime,space_cache,autodefrag,compress=lzo 0 2
UUID=2087d075-d2fa-4021-ac77-76006233748e /swap          btrfs   subvol=/@swap,defaults,noatime,space_cache,autodefrag,compress=lzo 0 2
/swap/swapfile                            swap           swap    defaults,noatime 0 0
tmpfs                                     /tmp           tmpfs   defaults,noatime,mode=1777 0 0

This is the Fstab for the computer

As long as you were using the same physical PC it should be fine.

[root@EndeavourOS liveuser]# sudo btrfs subvolume list /mnt/old
ID 256 gen 119 top level 5 path @
ID 257 gen 117 top level 5 path @home
ID 258 gen 117 top level 5 path @cache
ID 259 gen 117 top level 5 path @log
ID 260 gen 57 top level 5 path @swap
ID 263 gen 27 top level 256 path @/var/lib/portables
ID 264 gen 28 top level 256 path @/var/lib/machines

New disk doesn’t have anything on it

I deleted the second volume again as I wasn’t sure why it wasn’t working

You deleted the whole btrfs partition or just the subvolume you copied?

The subvolume I copied

Oh, here are the commands I used for making the subvolume

btrfs subvolume snapshot -r /mnt/old/@home /mnt/old/@home_old

btrfs send /mnt/old/@home_old | btrfs receive /mnt/new

brtrfs subvolume snapshot /mnt/new/@home_old /mnt/new/@home

btrfs subvolume delete /mnt/new/@home_old
btrfs subvolume delete /mnt/old/@home_old

btrfs subvolume list /mnt/old

OK, then it should be pretty straightforward from here:

sudo btrfs subvulume snap -r /mnt/old/@home /mnt/old/home-transfer
sudo btrfs send /mnt/old/home-transfer | sudo btrfs receive /mnt/new
sudo btrfs subvolume snap /mnt/new/home-transfer /mnt/new/@home

Then you can edit /etc/fstab and swap out the the UUID from the @home mount to:

 1f3aa823-969b-458d-aec3-6f7429d94e67
1 Like

That all looks fine to me. Maybe the mistake was in /etc/fstab?

Ah, so it should be like this??

fstab

UUID=468A-91CC                            /boot/efi      vfat    umask=0077 0 2
UUID=2087d075-d2fa-4021-ac77-76006233748e /              btrfs   subvol=/@,defaults,noatime,space_cache,autodefrag,compress=lzo 0 1
UUID=1f3aa823-969b-458d-aec3-6f7429d94e67 /home          btrfs   subvol=/@home,defaults,noatime,space_cache,autodefrag,compress=lzo 0 2
UUID=2087d075-d2fa-4021-ac77-76006233748e /var/cache     btrfs   subvol=/@cache,defaults,noatime,space_cache,autodefrag,compress=lzo 0 2
UUID=2087d075-d2fa-4021-ac77-76006233748e /var/log       btrfs   subvol=/@log,defaults,noatime,space_cache,autodefrag,compress=lzo 0 2
UUID=2087d075-d2fa-4021-ac77-76006233748e /swap          btrfs   subvol=/@swap,defaults,noatime,space_cache,autodefrag,compress=lzo 0 2
/swap/swapfile                            swap           swap    defaults,noatime 0 0
tmpfs                                     /tmp           tmpfs   defaults,noatime,mode=1777 0 0
[root@EndeavourOS liveuser]# btrfs subvolume list /mnt/old
ID 256 gen 123 top level 5 path @
ID 257 gen 121 top level 5 path @home
ID 258 gen 117 top level 5 path @cache
ID 259 gen 117 top level 5 path @log
ID 260 gen 57 top level 5 path @swap
ID 263 gen 27 top level 256 path @/var/lib/portables
ID 264 gen 28 top level 256 path @/var/lib/machines
ID 306 gen 121 top level 5 path home-transfer
[root@EndeavourOS liveuser]# btrfs subvolume list /mnt/new
ID 257 gen 11 top level 5 path home-transfer
ID 258 gen 11 top level 5 path @home