Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a BTRFS filesystem with a set of subvolumes in it. So far so good. I need to change the name of a subvolume, unfortunately the btrfs program does not allow me to rename a subvolume. Searching with Google has yielded some results, one said I can just mv, the other said I can just snapshot to a new name and delete the old subvolume. Before I crash my partition and have to reload it from the backup (it's quite large), my question is:

  • What is the currently best way to rename a subvolume?
  • Is it ok to just mv it, or will it invalidate some internal structures?
  • Is making a new snapshot and removing the old subvolume the way to go, or has this some drawbacks?

I know everything is still experimental, but for my purposes it has been working quite well (so far, and I have incremental backups for each day).

share|improve this question
1  
glad to hear btrfs is working well for you. It's working well for me too so far. No problems. – MountainX Apr 21 '12 at 23:27
up vote 8 down vote accepted

Just mv it. That's the recommended way in the Ubuntu community documentation.

And to further clarify why that is the right way to do it, here is a quote from the btrfs sysadmin guide:

Snapshots

A snapshot is simply a subvolume that shares its data (and metadata) with some other subvolume, using btrfs's COW capabilities. Once a [writable] snapshot is made, there is no difference in status between the original subvolume, and the new snapshot subvolume. To roll back to a snapshot, unmount the modified original subvolume, and mount the snapshot in its place. At this point, the original subvolume may be deleted if wished. Since a snapshot is a subvolume, snapshots of snapshots are also possible.

share|improve this answer

If you wanted to rename the root volume to a nested subvolume, you would need to snapshot it and then do a find $ROOT_VOL -xdev -delete to remove the previous contents of the root volume. The reverse manipulation (renaming a subvolume to the root volume) doesn't seem possible.

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .