备份逻辑卷
一 备份逻辑卷
1 查看逻辑卷大小 lvdisplay /dev/sonny/xiaofeng
[root@linuxprobe ~]# lvdisplay /dev/sonny/xiaofeng
--- Logical volume ---
LV Path /dev/sonny/xiaofeng
LV Name xiaofeng
VG Name sonny
LV UUID Z5JCJH-WgjQ-RG4Q-aAyw-MMt3-fDos-G7JCIU
LV Write Access read/write
LV Creation host, time linuxprobe.com, 2021-07-04 19:20:56 +0800
LV Status available
# open 1
LV Size 300.00 MiB
Current LE 75
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 8192
Block device 253:2
2 创建备份,大小300M,备份名SNAP lvcreate -L 300M -s -n SNAP /dev/sonny/xiaofeng
[root@linuxprobe ~]# lvcreate -L 300M -s -n SNAP /dev/sonny/xiaofeng
Logical volume "SNAP" created.
3 查看备份卷 lvdisplay /dev/sonny/SNAP
@linuxprobe ~]# lvdisplay /dev/sonny/SNAP
--- Logical volume ---
LV Path /dev/sonny/SNAP
LV Name SNAP
VG Name sonny
LV UUID EjAqU5-rFxs-2XKG-SVac-9fcw-1Uq1-EFZtqO
LV Write Access read/write
LV Creation host, time linuxprobe.com, 2021-07-04 23:10:59 +0800
LV snapshot status active destination for xiaofeng
LV Status available
# open 0
LV Size 300.00 MiB
Current LE 75
COW-table size 300.00 MiB
COW-table LE 75
Allocated to snapshot 0.01%
Snapshot chunk size 4.00 KiB
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 8192
Block device 253:5
二 从备份恢复
1 卸载逻辑卷 umount /dev/sonny/xiaofeng
[root@linuxprobe ~]# umount /dev/sonny/xiaofeng
2 恢复快照卷 lvconvert --merge /dev/sonny/SNAP
[root@linuxprobe ~]# lvconvert --merge /dev/sonny/SNAP
Merging of volume sonny/SNAP started.
sonny/xiaofeng: Merged: 100.00%
三 重新挂载
1 重新挂载 mount -a
[root@linuxprobe ~]# mount -a
2 查看挂载情况 df -hT|grep xiaofeng
[root@linuxprobe ~]# df -hT|grep xiaofeng
/dev/mapper/sonny-xiaofeng ext4 283M 2.1M 262M 1% /root/new_disk/lv/xiaofeng