notes/artix_backup.md
2025-11-23 20:17:06 -08:00

2 KiB

Backing Up On Artix

Backing Up:

Plug in your backup drive:

mount /dev/sda1 /mnt/media/usb-drive
doas rsync -aHAXS --exclude={"/dev/*","/proc/*","/sys/*","/tmp/*","/run/*","/mnt/*","/media/*","/lost+found","/home/brian/Videos/*","/home/brian/Documents/books/*","/home/brian/Downloads/*","/home/brian/Music/*","/home/brian/Pictures/*","/home/brian/Games/*"} /* /mnt/media/usb-drive/backup

Restoring:

Plug in the Artix base ISO (runit):

artixiso login: root
fdisk /dev/nvme0n1

boot

g (!! removes all disk partitions and creates a new GPT disklabel !!)

n (new partition)
t (select type of partition)
1 (mark the partition as an EFI system partition)
p (partition number)
Partition number (1 - 128, default 1): 1
First sector: (leave blank for default)
Last sector: +300M

n (new partition)
p (partition number) 2
default
default

w
mkfs.fat -F 32 /dev/nvme0n1p1
mkfs.ext4 /dev/nvme0n1p2

Now here is where we deviate from the installation:

mount /dev/nvme0n1p2 /mnt
mkdir /mnt/boot
mount /dev/nvme0n1p1 /mnt/boot

And run the rsync backup script:

rsync -aHAXS --exclude={"/dev/*","/proc/*","/sys/*","/tmp/*","/run/*","/mnt/*","/media/*","/lost+found"}  /mnt/media/usb-drive/backup/* /mnt

Now, to ensure that GRUB + mkinitcpio work:

mount --bind /dev /mnt/dev
mount --bind /proc /mnt/proc
mount --bind /sys /mnt/sys
mount --bind /run /mnt/run

Now chroot into the restored system:

artix-chroot /mnt

And regenerate grub:

grub-install --target=x86_64-efi --efi-directory=/boot --bootloader-id=GRUB
grub-mkconfig -o /boot/grub/grub.cfg

Make sure to regenerate the initramfs (important!):

mkinitcpio -P

And exit and reboot:

exit
umount -R /mnt
reboot

If all went well...

If all went well, you'll boot into a standard arch install, but with no Videos, Games, Music, books, Pictures, Downloads (too large, pick the ones you want from your backup).