kdave / btrfs-progs

Development of userspace BTRFS tools
GNU General Public License v2.0
563 stars 243 forks source link

Add a retain old fs option to replace? #534

Open CorrosiveTruths opened 2 years ago

CorrosiveTruths commented 2 years ago

Hi, would it feasible to have an option when using btrfs replace with a single fs device to leave the old filesystem intact on the replaced device?

That is, instead of removing the filesystem on the device being removed, generate a new UUID for it.

This would be useful as a backup / recovery in case something goes wrong on the new device (I had the idea when someone on reddit reported this very thing happened).

It would also be useful as a way to clone filesystems - so people don't use dd and end up with two devices with the same UUID.

kdave commented 2 years ago

So there are probably more things how to do tat:

Forza-tng commented 2 years ago

A btrfs clone could be a useful command. It save having to do the mkfs.btrfs, subvol create, and send|receive (hard to do with many or nested subvols and snaps) operations.