Usb Restorer
This repo contains a documentation on how to create and use a usb key for restoring a linux system.
TODO: Adding instructions to restore a windows system.
Create usb key
For a tutorial, follow this post from sebsauvage (in French)
Make sure your usb key is formatted in Fat32.
To create a restoring usb key, download linux mint lightweight
iso, and install multibootusb
.
Launch multibootusb
and choose the usb key on which you want to install the restoring system, select the iso, and in the MultibootUsb tab add some persistence memory, I recommand the maximum 4GB and click on install distro
.
Now you restart your computer and start on the usb key, git clone this repo and launch install.sh
scripts, this script will install all the needed packages for restoring a linux computer.
Be careful by default the keyboard is setup to french layout
Restoration tools
Access an luks encrypted disk
Use cryptsetup
to open a volume into a folder.
sudo cryptsetup luksOpen /dev/XXXX my_encrypted_volume
sudo mount /dev/mapper/my_encrypted_volume /mnt
To lock the volume again, unmount and crypt the volume.
sudo umount /mnt
sudo cryptsetup luksClose my_encrypted_volume
Access a veracrypt encrypted disk
Use veracrypt application to decrypt and mount the folder / disk.
Mount a disk / folder
Create the directory where the disk or folder will be mounted and mount it into this directory.
sudo mount /dev/XXXX /mnt
Unmount a disk / folder
sudo umount /mnt
Having root access into a disk / filesystem
You need to mount system, proc, dev, sys to the usb key system to have access to the filesystem root.
sudo mount /dev/XXXX /mnt
sudo mount --bind /dev /mnt/dev
sudo mount --bind /run /mnt/run
sudo mount --bind /sys /mnt/sys
sudo mount --bind /etc/resolv.conf /mnt/etc/resolv.conf
sudo mount -t proc /proc /mnt/proc
sudo mount -t sysfs /sys /mnt/sys
If grub reparation is needed you need to add:
sudo mount --bind /run /mnt/run
And after to have access into the system use chroot:
sudo chroot /mnt
If you have some problem with zsh or others specify bash binary.
sudo chroot /mnt /bin/bash
Backup a disk / folder
For this you can use fsarchiver
, partclone
, rclone
and borg
.
sudo borg init --encryption=none /mnt/backup.borg
borg create -v --stats --progress --exclude-from="filepath.txt" /backup/backup::{now} /
Exclude-backup.txt
/proc
/sys
/dev
/media
/mnt
/cdrom
/tmp
/run
/var/tmp
/var/run
/home/*/.thumbnails
/home/*/.cache/chromium
/home/*/.cache/mozilla
/home/*/.cache/wine
/home/*/.steam/steam/steamapps
/home/*/.steam/steam/config/htmlcache
/home/*/.local/share/Trash
/home/*/.mozilla/firefox/*.default/Cache
/home/*/.gvfs
/swapfile
*.!qB
Deleting file
You can delete file with a secure standard thanks to secure-delete
.