EmanueleC
Utente Èlite
- Messaggi
- 5,713
- Reazioni
- 1,878
- Punteggio
- 168
Sul fstab aggiungi l'opzione di mount del subvol @snapshot. Ma perché creare un subvol per gli snapshot? questa non l'ho capita...
mount /dev/sda1 /mnt/btrfsradice
ed hai tutta la radice con i subvol:
sudo btrfs subvolume snapshot /mnt/btrfsradice/@ o @home /mnt/btrfsradice/@nomesnap
dovrebbe funzionare cosi.
mount /dev/sda1 /mnt/btrfsradice
ed hai tutta la radice con i subvol:
sudo btrfs subvolume snapshot /mnt/btrfsradice/@ o @home /mnt/btrfsradice/@nomesnap
dovrebbe funzionare cosi.
Ubuntu-specific subvolume layout in 11.04 and later
In Ubuntu 11.04 and later, the installer sets up btrfs with a specific layout:
The default subvolume to mount is always the top of the btrfs tree (subvolid=5).
Subvolumes are created below the top of the btrfs tree as needed, e.g. for / and /home, it creates subvolumes named @ and @home. This means that specific options are needed in order to mount the subvolumes, instead of the default btrfs tree top:
- The @ subvolume is mounted to / using the kernel boot option rootflags=subvol=@
- The @home subvolume (if it is used), is mounted via the mount option subvol=@home in fstab.
How to work with snaphots in Ubuntu's layout
In order to work with snapshots of / or /home in the Ubuntu layout it is very convenient to mount the btrfs filesystem at a separate location, and work from the top of the btrfs tree, rather than from the mounted subvolumes.
sudo mount /dev/sdX# /mnt
Create snapshots
To create a snapshot use
sudo btrfs subvolume snapshot /mnt/@ /mnt/@_snapshot
this will create a snapshot of the @ subvolume named @_snapshot located also in the top of the btrfs tree.
Rollback to a snapshot
To roll back to a snapshot, you simply need to change its name to the name that ubuntu mounts, using
sudo mv /mnt/@ /mnt/@_badroot
sudo mv /mnt/@_snapshot /mnt/@
and reboot.
Delete a snapshot
To delete a snapshot use
sudo btrfs subvolume delete /mnt/@_badroot
btrfs snapshots are subvolumes in themselves, and self-contained, deleting the old @ subvolume like this is fine, provided we have a replacement.