Answer the question
In order to leave comments, you need to log in
Full system backup on LVM?
There is ubuntu, which, during installation, offered to create itself on LVM, now I'm racking my brains on how to back up this scheme.
NAME FSTYPE LABEL MOUNTPOINT
sda
├─sda1 vfat
├─sda2 ext2 /boot
└─sda3 LVM2_member
├─ubuntu--vg-root (dm-0) ext4 /
└─ubuntu--vg-swap_1 (dm-1) swap [SWAP]
Answer the question
In order to leave comments, you need to log in
As I understand it, you need a disaster recovery, i.e. data recovery to an empty disk. This is done in the following way. Suppose you have /media/ssd01 directory on the server with backup-storage backups, then
1. Mount the directory
mount -t nfs backup-storage:/media/ssd01 /mnt/backup
2. Create a subdirectory with backup
export backupdate=$( date --iso-8601=seconds)
mkdir /mnt/backup/backup-$(backupdate)
3. You seem to have a GPT partition, so use sgdisk. Back up the disk layout to a file.
sudo sgdisk -b /mnt/backup/backup-$(backupdate)/disk_layout.bin /dev
/
sda backup-$(backupdate)/EFI
mkdir /mnt/backup/backup-$(backupdate)/boot
cp -a /<where is sda1 mounted there and is it mounted at all?> /mnt/backup/backup-$(backupdate)/EFI
cp -a /boot /mnt/ backup/backup-$(backupdate)/boot
5. Copy the location of the LVM partitions
vgcfgbackup -f /boot /mnt/backup/backup-$(backupdate)/lvm.txt
6. Snapshot the root partition
lvcreate -s -n backup - L20G /dev/ubuntu--vg/root
7. Back up only completed snapshot blocks partclone.extfs
-c -s /dev/ubuntu--vg/backup -o /mnt/backup/backup-$(backupdate)/ubuntu-- vg-root.img
8. Remove the snapshot
lvremove /dev/ubuntu--vg/backup
9. Unmount the backup directory
umount /mnt/backup
The whole thing is driven into the script and twitches once a day on the crown. Expand - in the same order, but there are subtleties, for example, before vgcfgrestore you need to do pvcreate --restorefile <file> --uuid .
Copying /dev/sda via dd is a very bad idea, you will lose filesystem integrity. The write resource of the SSD is now such that you can not be afraid to write to it as much as you need.
You need to take off your windowed glasses and enjoy life ......
Linux is built on files. You can just copy them.
There is, for example, the rsync utility, which redraws only changed files.
Since you did not specify the purpose of using this machine, I will simply mention that database servers cannot be backed up in this way and their toolkit must be used.
Treat LVM2 as an extra layer of abstraction. You are free to ignore it when it suits you and remember it when necessary.
Your usual toolkit will continue to work as before. So there are two options listed. The difference is only in the approach.
In the first case, in order not to risk data consistency when working with dd , it is recommended to suspend the services and the system. This is often inconvenient.
In the second case, you start to take advantage of LVM. A snapshot is the freezing of data on a disk. All subsequent changes are written on a new layer. In this case, you can safely back up the snapshot without interrupting the system and services. And at the end, merge the changes with the snapshot, then deleting it.
No way. You have not understood the essence of snapshot. It is your data on the disk.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question