-
Notifications
You must be signed in to change notification settings - Fork 0
backup
XADE edited this page Jul 4, 2024
·
2 revisions
WARNING: must be avoided on immutable distro
The script installs the distributions in a way making it easier to
- backup
- as we will be backing up the whole root volume including kernel i.e
/boot
- only directory excluded will be
/fat
i.e. the mount point of Fat partition - backing up subvolumes created by user, other other than root i.e.
/
is out of scope for this page
- as we will be backing up the whole root volume including kernel i.e
- boot into backups
considering btrfs-progs and gawk is already installed, save the below script somewhere.
#!/bin/sh
# unmount everything from /mnt
umount -Rl /mnt
# store the root device as BLK
BLK=$(mount | awk '/ \/ / {printf $1}')
# store the name of root subvol as VOL
VOL=$(mount | awk -F 'subvol=/|)' '/ \/ / {printf $2}')
# mount root device on /mnt
mount "$BLK" /mnt
# delete the previous snapshot
btrfs subvol delete /mnt/snap_"$VOL"
# create snapshot of current system
btrfs subvol snapshot /mnt/"$VOL" /mnt/snap_"$VOL"
# upgrade the system
pacman -Syu # For pacman
xbps-install -Syu # For xbps
apk --update-cache upgrade # For apk-tools
kiss update # For kiss
kiss Upgrade
emaint --auto sync # For portage
emerge --update --deep --newuse @world
# update GRUB menu
grub-mkconfig -o /boot/grub/grub.cfg
simply run the above script to to backup and upgrade the system. One may also set an alias for the above task.
The following is only needed to be done once
Considering the installation was named name_of_installation (during installation)
- open /fat/grub/grub.cfg with an editor
- create a duplicate entry of menuentry name_of_installation {} below it
- in that duplicate entry replace name_of_installation with snap_name_of_installation
when booting up next time, GRUB will show an extra entry for snap_my_installtion which can be choosen to boot into backups.