Upgrading btrfs @home mount with dedicated drive


I currently have a single disk containing @ (root) and @home subvolumes. I’m using timeshift to take backups of the root partition and snapper (btrfs-assistant) to take backups of /home. Everything is working great except my disk is getting maxed out and so I want to migrate /home to a dedicated 1TB drive.

Currently the @ (root) and @home are mounted as such:

UUID=f6e56409-da8e-43b1-b238-d041419bbce4 /        btrfs   subvol=@,compress=zstd:1,ssd,noatime,space_cache=v2,discard=async 0 0
UUID=f6e56409-da8e-43b1-b238-d041419bbce4 /home    btrfs   subvol=@home,compress=zstd:1,ssd,noatime,space_cache=v2,discard=async 0 0

These are the available filesystems

~/ sudo btrfs filesystem show
Label: 'fedora_localhost-live'  uuid: f6e56409-da8e-43b1-b238-d041419bbce4
	Total devices 1 FS bytes used 159.65GiB
	devid    1 size 199.30GiB used 192.07GiB path /dev/nvme1n1p3

Label: 'Home'  uuid: 54678ba4-0944-45a9-8027-497aee5cfba4
	Total devices 1 FS bytes used 637.52GiB
	devid    1 size 953.87GiB used 641.02GiB path /dev/nvme0n1p1

These are the subvolumes mounted on /

btrfs subvolume list /

ID 257 gen 120222 top level 5 path @home
ID 494 gen 120207 top level 5 path @
ID 511 gen 120152 top level 257 path @home/.snapshots
ID 638 gen 119007 top level 5 path timeshift-btrfs/snapshots/2022-09-01_20-06-55/@
ID 674 gen 119007 top level 5 path timeshift-btrfs/snapshots/2022-09-03_10-00-01/@
ID 694 gen 119007 top level 5 path timeshift-btrfs/snapshots/2022-09-04_14-00-02/@
ID 723 gen 119007 top level 5 path timeshift-btrfs/snapshots/2022-09-05_12-00-01/@
ID 875 gen 119007 top level 5 path timeshift-btrfs/snapshots/2022-09-09_21-00-02/@
ID 876 gen 119007 top level 5 path timeshift-btrfs/snapshots/2022-09-09_22-14-31/@
ID 877 gen 119007 top level 5 path timeshift-btrfs/snapshots/2022-09-09_23-21-20/@
ID 972 gen 119007 top level 5 path timeshift-btrfs/snapshots/2022-09-13_14-00-02/@
ID 1012 gen 119007 top level 5 path timeshift-btrfs/snapshots/2022-09-14_18-00-01/@
ID 1254 gen 119007 top level 5 path timeshift-btrfs/snapshots/2022-09-23_21-00-01/@
ID 1257 gen 66675 top level 494 path var/lib/docker/btrfs/subvolumes/ab0d5fbba151ed84f96f00aa448b463675913c2a5224d42eccf9093f229b4037
ID 1258 gen 66673 top level 494 path var/lib/docker/btrfs/subvolumes/f52451a1a0cee52d1de74348b840cbd2c25da13efe116b15b7d45de2d4d024a9-init
ID 1259 gen 66673 top level 494 path var/lib/docker/btrfs/subvolumes/f52451a1a0cee52d1de74348b840cbd2c25da13efe116b15b7d45de2d4d024a9
ID 1260 gen 66676 top level 494 path var/lib/docker/btrfs/subvolumes/6ba6a864c29a7d1a01ac3201587ec3d6471f717242c968fa71a3c3061e7557f4-init
ID 1261 gen 66676 top level 494 path var/lib/docker/btrfs/subvolumes/6ba6a864c29a7d1a01ac3201587ec3d6471f717242c968fa71a3c3061e7557f4
ID 1363 gen 119007 top level 5 path timeshift-btrfs/snapshots/2022-09-27_20-00-01/@
ID 1537 gen 119007 top level 5 path timeshift-btrfs/snapshots/2022-10-05_08-55-04/@
ID 1769 gen 119007 top level 5 path timeshift-btrfs/snapshots/2022-10-13_13-42-30/@
ID 1822 gen 119007 top level 5 path timeshift-btrfs/snapshots/2022-10-16_13-00-01/@

I formatted my new drive, with gnome-disks as a btrfs. Mounted it to /mnt/new_home and copied all the data from /home to it using tar -cf - /home |tar -C /mnt/new-home -xvf - and all files and permissions look to be okay.

At this point I’m not sure how to proceed. I tried to update the fstab by commenting out the original /home entry and replacing it with the one below but It goes straight to system maintenance mode until I put the original entry back in place. I’m guessing I may to do some work in a liveboot environment, not sure

# New Home:
UUID=54678ba4-0944-45a9-8027-497aee5cfba4 /home   btrfs   subvol=home,compress=zstd:1,ssd,noatime,space_cache=v2,discard=async 0 0

Anyone know what I need to do get the new home drive mounted up right so I can back it up with Snapper and also how I can mount the original home to /mnt/old_home until everythings working and i can delete it?

I’m learning btrfs atm so any help is really appreciated!


Simply manage it as has always been done when migrating data between volumes.

  1. Create the partition and file system on the second drive
  2. mount the new file system at /mnt
  3. copy everything from your /home directory to the new file system.
    sudo -av rsync /home/ /mnt/ should handle that.
  4. modify /etc/fstab to mount the new filesystem on the new drive at /home
  5. reboot
  6. mount the old btrfs subvolume for home at /mnt
    (this could also be done by modifying the existing entry in /etc/fstab in step 4)
  7. As long as the copy of data in step 3 went well and the reboot gives you the proper file system mounted at /home, then simply delete all the data in the volume mounted at /mnt which will free up that space for use by the root file system.
  8. Final step is to unmount the volume at /mnt and to (if needed) delete its entry from /etc/fstab.
1 Like

Thanks Jeff!

I think I followed those steps very similarly but rebooting failed and took me to the system maintenance login without X or GUI.

Does the last vfstab entry look okay to you? I’m not sure if I should be using subvol=@home or subvol=home (or even if this matters).

Also does it matter that the new home directory is hosted on a separate storage device (not same as root drive now)?

Btw. These are the subvolumes that listed on the new_home mount:

~/ sudo btrfs subvolume list /mnt/new-home
[sudo] password for sunil:
ID 257 gen 161 top level 5 path sunil/.local/share/Steam/steamapps
ID 259 gen 192 top level 5 path sunil/Games
(base) █▓▒░sunil@SUNIL-Fed█▓▒░ Mon Oct 31 03:48:43pm

I feel like i’ve not done something right as I can create subvolumes under new_home but it doesn’t have a name (like the original @home)… any idea?


The “subvol=home” part of the fstab entry is telling the system to look for a subvolume labeled “home” on your new disk. But looking at your output for btrfs subvolume list, it doesn’t appear that there is a subvolume with that name.

1 Like

Detailed steps to create the new file system are

  1. Create a btrfs volume on the new drive
  2. Create a new subvolume on the new drive with a name you choose
  3. Identify the UUID of the btrfs volume
  4. place that UUID and subvolume name into /etc/fstab similarly to what is already there for /home but have it mount at /mnt.
  5. comment out the existing entry for /home so it no longer mounts that subvolume.
  6. perform the previously noted mount of the new subvolume at /mnt, copy the data over, then reboot.

It is always a good idea to mount the new volume while at the command line so you are sure the options you entered will work. Your fstab entries are much more complex than mine on a new install of F37 and F36

UUID=a9f840d4-01ef-499b-a6e3-e45972b0e21a /                       btrfs   subvol=root,compress=zstd:1 0 0
UUID=a9f840d4-01ef-499b-a6e3-e45972b0e21a /home                   btrfs   subvol=home,compress=zstd:1 0 0

With that, mounting the home subvolume could be done from the command line with
sudo mount -t btrfs -o subvol=home,compress=zstd:1 UUID=a9f840d4-01ef-499b-a6e3-e45972b0e21a /home
Of course the UUID and mount point and subvol name are replaced with values for your system.

1 Like

Thanks Guys. Yep I’m making head way now, thanks.

I tried to create a directory called @home in the new home mount and put all the files in there. The system boots into the gui login but won’t get past that now, so my cheeky shortcut has failed!

I’ll create the subvolume and copy the data over again and test again…

Thanks again!

Directories and btrfs subvolumes are not the same. You have to start with the btrfs volume, then create the btrfs subvolume, then mount the subvolume on a directory mount point within the file system.

A subvolume is analagous to a partition in an ext4 file system.


Roger that! Learned a whole bunch today, appreciate it, cheers Jeff! S

Before I redo the data migration, I thought I’d create a new @home subvolume on the new drive and move the old data to it. This is how it looks now:

# sudo mount /dev/nvme0n1p1 /mnt/new_home                                                                                                                                          # cd new_home

# ls -l
drwxr-xr-x. root root 48 B Mon Oct 31 17:53:04 2022  @home

# sudo btrfs su li .
ID 259 gen 218 top level 260 path @home/sunil/Games
ID 260 gen 226 top level 5 path @home

The @home subvolume is owned by root, I’m assuming this is correct as it matches the /home permissions?

Also before I created the new @home subvolume, I had already created @home/sunil/Games, so the ID for @home is higher. Would this matter? Still unable to login via the GUI, but maybe there’s a quicker way to fix this other than another data copy?


If the device is a btrfs volume that will not work. You must mount the subvolume and not the main volume as has been previously stated. The file system does not exist at the btrfs volume level but only at the subvolume level. You also have to tell mount that it is a btrfs file system and explicitly identify the subvolume to be used in the options.

Your issue is still not fully understanding how to manipulate btrfs volumes and subvolumes.

Use the man pages for btrfs and btrfs-subvolume (among others btrfs related) to understand how to manipulate that file system. Read the man page for btrfs-subvolume carefully to understand the use of the btrfs subvolume command for creating and using a subvolume.

Once properly created and mounted the file system on a btrfs subvolume is seen by the system the same as any other file system.

This is what I see on my newly installed VM with fedora 36.

$ mount
/dev/vda3 on / type btrfs (rw,relatime,seclabel,compress=zstd:1,space_cache=v2,subvolid=257,subvol=/root)
/dev/vda3 on /home type btrfs (rw,relatime,seclabel,compress=zstd:1,space_cache=v2,subvolid=256,subvol=/home)
tmpfs on /tmp type tmpfs (rw,nosuid,nodev,seclabel,nr_inodes=1048576,inode64)
/dev/vda2 on /boot type ext4 (rw,relatime,seclabel)
/dev/vda1 on /boot/efi type vfat (rw,relatime,fmask=0077,dmask=0077,codepage=437,iocharset=ascii,shortname=winnt,errors=remount-ro)

and /etc/fstab shows this for those 4 mount points.

UUID=a9f840d4-01ef-499b-a6e3-e45972b0e21a /                       btrfs   subvol=root,compress=zstd:1 0 0
UUID=b38b487c-7a7a-496b-b109-ef166b6fc0c8 /boot                   ext4    defaults        1 2
UUID=8F91-A05A          /boot/efi               vfat    umask=0077,shortname=winnt 0 2
UUID=a9f840d4-01ef-499b-a6e3-e45972b0e21a /home                   btrfs   subvol=home,compress=zstd:1 0 0
1 Like

Thanks Jeff! I’ll take a closer look … :+1: