On Tue, 2015-11-24 at 23:30 +0000, Hugo Mills wrote: > Yes, that makes sense. Feel free to shamelessly use my idea (as well as the one to call btrfs' RAID1 replica2 or something else) :-O
> With a recent mv root@heisenberg:/mnt# mv --version mv (GNU coreutils) 8.23 => not recent enough... > but I think you'll find that the UUID of the subvols changes. (At > least, I hope it does. If it doesn't, then my mental model of what > the FS is doing is *really* screwed up). Well... see below: root@heisenberg:~# truncate -s 2G image root@heisenberg:~# losetup -f image root@heisenberg:~# mkfs.btrfs /dev/loop0 btrfs-progs v4.3 See http://btrfs.wiki.kernel.org for more information. Performing full device TRIM (2.00GiB) ... Label: (null) UUID: 10e1a55c-448a-4f37-ae5c-6a7801a7f202 Node size: 16384 Sector size: 4096 Filesystem size: 2.00GiB Block group profiles: Data: single 8.00MiB Metadata: DUP 110.38MiB System: DUP 12.00MiB SSD detected: no Incompat features: extref, skinny-metadata Number of devices: 1 Devices: ID SIZE PATH 1 2.00GiB /dev/loop0 root@heisenberg:~# mount /dev/loop0 /mnt/ root@heisenberg:/mnt# btrfs subvolume create root Create subvolume './root' root@heisenberg:/mnt# btrfs subvolume create below-top Create subvolume './below-top' root@heisenberg:/mnt# cd root/ root@heisenberg:/mnt/root# btrfs subvolume create below-root Create subvolume './below-root' root@heisenberg:/mnt# btrfs subvolume list /mnt/ -pacguqt ID gen cgen parent top level parent_uuid uuid path -- --- ---- ------ --------- ----------- ---- ---- 257 9 7 5 5 - 8fbf521e-77f9-0d49-9891-87767f98c655 root 258 8 8 5 5 - b49131e9-4207-aa42-8195-c50de5f06136 below-top 259 9 9 257 257 - 20c042be-ead8-204a-a684-94c1a770e739 <FS_TREE>/root/below-root root@heisenberg:/mnt# mv root/below-root/ tmp root@heisenberg:/mnt# mv below-top/ root/ root@heisenberg:/mnt# mv tmp/ below-root root@heisenberg:/mnt# btrfs subvolume list /mnt/ -pacguqt ID gen cgen parent top level parent_uuid uuid path -- --- ---- ------ --------- ----------- ---- ---- 257 9 7 5 5 - 8fbf521e-77f9-0d49-9891-87767f98c655 root 258 8 8 257 257 - b49131e9-4207-aa42-8195-c50de5f06136 <FS_TREE>/root/below-top 259 9 9 5 5 - 20c042be-ead8-204a-a684-94c1a770e739 below-root root@heisenberg:/mnt# So the UUIDs seem to stay the same (or are these other UUIDs?) Hope I haven't ruined your day now ;-) Cheers, Chris.
smime.p7s
Description: S/MIME cryptographic signature