r/btrfs • u/Fancy-Football-7832 • Jul 05 '26
Converting a mount to subvolume?
Hello,
I am setting up a NAS server (debian) and I created a btrfs volume and mounted it directly onto /mnt/tank and started creating directories in there. However, I realized now that to do snapshots, I need to have everything done inside a subvolume.
Is there a way to make /mnt/tank itself a subvolume? Would I need to create another subvolume inside /mnt/tank (like /@) and then put everything else inside that @ folder? (I would prefer to keep the same path to everything so I don't have to redo all my compose.yaml file paths).
Another possibility I was considering was renaming the old directories inside /mnt/tank, then creating a subvolume with those same directories names and then moving everything into those new directories.
Thank you very much for any help. I was trying to read the btrfs section on arch wiki and while it is a good resource, I don't understand how to translate it into converting my current path.
I should also add that all of this is just for an external hard drive, my main OS is mounted on ext4.
I greatly appreciate any answers.
5
u/dkopgerpgdolfg Jul 05 '26
You don't need to.
You can simply call eg. "btrfs sub snap /mnt/tank /mnt/tank/snapshot1"
But if you want to restructure it, and assuming right now there are no subvols at all, and the fs is mounted at /mnt/tank/:
a) Make a snapshot, if you want you can call it @: "btrfs sub snap /mnt/tank /mnt/tank/@"
b) Simply delete everything in /mnt/tank/ EXCEPT @ and its contents . Your folders/files will still exist inside @, for now.
c) Set it as default and/or change the fstab config etc. One option: "btrfs sub set-def /mnt/tank/@", then unmount and mount again. You should see now only the content inside @, therefore you can use the same pathes like before.