You are not logged in.

#1 2023-09-16 16:22:21

860lacov
Member
Registered: 2020-05-02
Posts: 497

Is my understanding of btrfs subvolume snapshot correct?

nvme0n1       259:0    0 931,5G  0 disk  
├─nvme0n1p1   259:1    0   500M  0 part  /boot
└─nvme0n1p2   259:2    0   931G  0 part  
  └─cryptroot 254:0    0   931G  0 crypt /var/lib/docker/btrfs
                                         /var/cache
                                         /home
                                         /

root is mounted in fstab like this:

/               btrfs           rw,noatime,compress=zstd:3,ssd,space_cache=v2,commit=120,subvol=@        0 0

So on encrypted partiton I have 3 subvolume
@, @home, @cache

Before system update, I would like to mount /dev/mapper into /mnt
It gives me:

ls /mnt/
@  @cache  @home

I would like to create snapshot with
btrfs subvolume snapshot @ @_bak

Then I would like to do pacman -Syu

Lets say that after 2 days of laptop usage I would like to revert changes.

I would mount again cryptroot into /mnt
rename @ to @_old and @_bak to @
and restart system?

Should it work?
can I delete @_old before restarting or do I have to do it after restart? Or I can't do it at all?

I tried to do something like this some time ago and I messed up my system. I don't remember what I did wrong.

Last edited by 860lacov (2023-09-16 16:23:38)

Offline

#2 2023-09-16 17:54:48

ScarletFire
Member
Registered: 2023-08-29
Posts: 6

Re: Is my understanding of btrfs subvolume snapshot correct?

I would mount again cryptroot into /mnt
rename @ to @_old and @_bak to @
and restart system?

Yes you can rename the subvolumes while the system is running and then simply reboot.

can I delete @_old before restarting or do I have to do it after restart? Or I can't do it at all?

If after rebooting everything works fine you can delete the old subvolume with the btrfs command.

If you are unsure you could first try it out inside a virtual machine or a secondary drive.

Offline

Board footer

Powered by FluxBB