]> www.wagner.pp.ru Git - oss/restore.git/blob - README.md
2d43d8e541018fbf395d1ef4e1cc7548c61b7d92
[oss/restore.git] / README.md
1 Restoration script for full linux backup
2 ========================================
3
4 Prepare for backups
5 -------------------
6
7 Before you'll be able to restore your system from backup, you have to do
8 backups.
9
10 1. Get an USB thumb drive or external HDD big enough to hold entire
11    content of our notebook's SSD.
12 2. Install gparted-live into beginning of this disk
13 3. Format rest of this disk (gparted would take no more than half of GB
14 at the beginning) as ext4 system
15 4. Install rsnapshot on your machine and set up it to make backup into
16    ```
17    /media/${your name}/${label of your USB partition}/${hostname}
18    ```
19    If you have big usb HDD and several notebooks, you can backup all of
20    them on one medium.
21    You should backup everything including /boot/efi, although you can
22    omit mozilla cache and other thinks which are likely to change during
23    backup.
24
25 5. Do first backup. Do:
26    ```
27    echo p |fdisk /dev/nvme0n1 > partitions.layout  
28
29    copy restore script into root of your backup partition.
30
31 Do backup regularly
32 -------------------
33
34 Don't forget to insert this USB drive into your notebook and run 
35 rsnapshot with appropraite argument as root on regular basis.
36
37 Use alpha/beta/gamma modes of rsnapshots, so you'll store daily backups
38 for last week, weekly ones for last month and several monthly ones.
39
40 Restore old files occasionaly
41 -----------------------------
42
43 Sometimes you'll find out that you have incedently removed or modified
44 some file. You can than plug your backup drive in and get yesterday's or
45 week ago copy.
46
47 When disaster happens
48 ---------------------
49
50 When your SSD drive dies, or have been irrepairable  wiped out,
51 or hit by trojan or cryptolocker so it is easier to wipe out then do 
52 anythin else:
53
54 1. Repair the hardware
55 2. Insert your backup drive in USB port and boot from it. Mount your
56    second partition under, say /mnt
57 3. From parted-live GUI create neccessary partitions. You can consult
58    partitions.layout file which you have created while preparing backup.
59    Don't forget create vfat partion for /boot/efi, if you are using uefi
60    boot.
61 4. Mount newly created root partition under, say /target
62    and if you unse separate partions for /home, /var or anything else,
63    mount them on /target/home, /target/var etc.
64    Don't forget to mount /target/boot/ef
65 5. Cd to /mnt and run 
66     ```
67     restore /target
68         ```
69     IF you keep backup for several
70     compiters on one disk or want to restore not the latest daily backup,
71     specify backup directory
72     
73         ```
74     restore mynote/beta.1 /target
75         ```
76 6. Reboot and enjoy.
77
78 Other uses
79 ----------
80
81 You can use this restoration procedure when you are upgrading your main
82 SSD - no need to search for USB SATA or USB NVME controller to copy data
83 from old disk. That is why we don't create partitions from script. User
84 may want to rearrange partition layout or just restore system on bigger
85 drive.
86
87