Backup and recovery of Linux system

Time:2021-2-6

Backup and recovery of Linux system

Delete library and runI often hear about it. However, it can only be a topic of ridicule. I can’t do it in real work. Otherwise, the library will be deleted and I’m afraid I can’t run away.

So, backup is very important!!!!!

Tar command

Copy (local)backupsThe whole system, later restore or restore to this machine)

Note that the root directory should have enough free space for backup.

cd /
  • /Proc permission: file owner: root group: root owner: read execute group: read execute others: read execute
  • /Lost + found permission: file owner: root group: root owner: read write execution group: read execute others: read execute
  • /MNT permission: file owner: root group: root owner: read write execution group: read execute others: read execute
  • /Sys permission: file owner: root group: root owner: read write execution group: read execute others: read execute

After the recovery is completed and the restart is completed, all things will be the same with youbackupsIt’s as like as two peas.

Image (local backup system, restore to new host)

1. Check the system version, install the same version of the system on the target machine (the simplest installation is enough), partition format and type are the same (I haven’t tried different situations, I don’t know if it will succeed)

lsb_release -a
uname -a
df -Th
free -h

2. Backup the source system

#Because the hardware configuration of the target host and the source host is different, exclude Dev and TMP, and add the files you want to exclude appropriately, such as: - exclude = / root / *. Bz2

3. Start with ISO, livecd, etc. on the target machine, and mount the disk (generally, it will be automatically mounted to the / media folder)

sudo -s  

Rsync command

Note that the format of the target partition should be NTFS, fat, ext and other formats to avoid the problem that files larger than 4G cannot be backed up.

#It is better to have other partition or external storage device, Mount well, DF - LH see mount point.

DD command

DD command belongs to sector clone, the target partition is larger than the backup partition, even if the unused space will be cloned as is, it will be slower.

#Backup

Author: Leo Lan’s blog

Source:https://www.leolan.top/index….

Backup and recovery of Linux system