Closed rbellamy closed 10 years ago
Hi @rbellamy,
I've tested it, and can't get whats wrong with your setup. In my opinion it should work. Check out the following.
Setup a test partition, like your's:
$ cd /tmp
$ sudo su
# dd if=/dev/urandom of=./drive count=100 bs=1M
# losetup /dev/loop0 ./drive
# mkfs.btrfs -L test /dev/loop0
# mkdir ./test
# mount /dev/loop0 ./test
# cd ./test
# btrfs su cr __system
# btrfs su cr __system/root
# btrfs su cr __system/home
# btrfs su cr __snapshot
# btrfs subvolume list . --sort=gen | awk '{print $2 ",/" $9}'
257,/__system/root
256,/__system
258,/__system/home
259,/__snapshot
Now use some code from mkinitcpio-btrfs:
# work="."
# BTRFS_DIR_ACTIVE="/__system/root"
# x="$(btrfs subvolume list ${work} | awk '{print $2 ",/" $9}' | grep -E "^[0-9]*,${BTRFS_DIR_ACTIVE}$")"
# BTRFS_BOOT_SUBVOL=${x#*,}
# BTRFS_BOOT_SUBVOLID=${x%,*}
# btrfs subvolume set-default ${BTRFS_BOOT_SUBVOLID} ${work}
And here comes the result:
# btrfs subvolume get-default ${work}
ID 257 gen 7 top level 5 path __system/root
Finally cleanup:
# cd ..
# umount ./test
# losetup -d /dev/loop0
# rm ./drive
# exit
I don't understand it, can you give me a hint?
Oh wow... sorry just noticed your request for more info. I've tried to reproduce, and haven't been able to... so closing this is the right thing. Sorry for the late response.
This was not meant to be offense. And I had a long response time too :) If you are able to provide the requested infos, please reopen it any time.
I have the following:
With
__system/ROOT
set as the default subvolume.I then boot, and the default subvolume is set to
__system
, regardless of the value ofBTRFS_DIR_ACTIVE
in/etc/defaults/btrfs_advanced
I realize now after reading some more and looking at the code, that this is by design. But thought someone else might find it useful if it were mentioned here.