群晖存储空间损毁测试恢复操作

# 卸载挂载点

root@DS3622:/dev/mapper# umount /dev/mapper/cachedev_0

#检查下文件系统 
root@DS3622:/dev/mapper# btrfs check /dev/mapper/cachedev_0
Syno caseless feature on.
Checking filesystem on /dev/mapper/cachedev_0
UUID: 2e52782f-82fa-4876-b364-45c971a6f6d2
checking extents
Syno block group cache is sync
checking free space tree
checking fs roots
checking csums
checking root refs
found 262144 bytes used err is 0
total csum bytes: 0
total tree bytes: 262144
total fs tree bytes: 49152
total extent tree bytes: 16384
btree space waste bytes: 247201
file data blocks allocated: 0
referenced 0


#确认下lv逻辑卷 存储空间逻辑卷 在哪个VG卷组上

root@DS3622:/dev/mapper# lvdisplay
--- Logical volume ---
LV Path /dev/vg2/syno_vg_reserved_area
LV Name syno_vg_reserved_area
VG Name vg2
LV UUID ziPwji-Wjda-yAM2-7F8g-SFIO-t41d-MVw6kT
LV Write Access read/write
LV Creation host, time ,
LV Status available
# open 0
LV Size 12.00 MiB
Current LE 3
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 384
Block device 249:2

--- Logical volume ---
LV Path /dev/vg2/volume_2
LV Name volume_2
VG Name vg2
LV UUID NpYscG-HIsv-HEpd-GTfd-2Ljb-de1q-5UAQZW
LV Write Access read/write
LV Creation host, time ,
LV Status available
# open 1
LV Size 489.00 GiB
Current LE 125184
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 384
Block device 249:3

--- Logical volume ---
LV Path /dev/vg1/syno_vg_reserved_area
LV Name syno_vg_reserved_area
VG Name vg1
LV UUID mRfxjt-D2k9-YznF-C5UR-86gh-oY2k-KTXMf2
LV Write Access read/write
LV Creation host, time ,
LV Status available
# open 0
LV Size 12.00 MiB
Current LE 3
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 512
Block device 249:0

--- Logical volume ---
LV Path /dev/vg1/volume_1
LV Name volume_1
VG Name vg1
LV UUID DH0GM1-8hEE-2ieV-jwU1-auhJ-wm8d-WgBAm9
LV Write Access read/write
LV Creation host, time ,
LV Status available
# open 1
LV Size 979.00 GiB
Current LE 250624
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 512
Block device 249:1

 

#确认存储空间2在volume2在vg2上,运行 vgcfgrestore命令 查看下之前保存的元数据

root@DS3622:/dev/mapper# vgcfgrestore -l vg2

File: /etc/lvm/archive/vg2_00000-820162421.vg
Couldn't find device with uuid YaTqsg-eH3s-Uub2-2Fsu-iKTd-fO6f-KviSEg.
VG name: vg2
Description: Created *before* executing '/sbin/vgcreate --physicalextentsize 4m /dev/vg2 /dev/md3'
Backup Time: Wed Apr 13 15:00:53 2022


File: /etc/lvm/archive/vg2_00001-1859144599.vg
VG name: vg2
Description: Created *before* executing '/sbin/lvcreate /dev/vg2 -n syno_vg_reserved_area --size 12M'
Backup Time: Wed Apr 13 15:00:53 2022


File: /etc/lvm/archive/vg2_00002-1120236689.vg
VG name: vg2
Description: Created *before* executing '/sbin/lvcreate /dev/vg2 -n volume_2 --size 1002496M'
Backup Time: Wed Apr 13 15:04:14 2022


File: /etc/lvm/archive/vg2_00003-661252791.vg
VG name: vg2
Description: Created *before* executing '/sbin/lvremove -f /dev/vg2/volume_2'
Backup Time: Sun Jun 26 14:37:25 2022


File: /etc/lvm/archive/vg2_00004-328407961.vg
VG name: vg2
Description: Created *before* executing '/sbin/vgremove -f /dev/vg2'
Backup Time: Sun Jun 26 14:37:26 2022


File: /etc/lvm/archive/vg2_00005-1208294521.vg
VG name: vg2
Description: Created *before* executing '/sbin/vgcreate --physicalextentsize 4m /dev/vg2 /dev/md3'
Backup Time: Sun Aug 28 18:10:46 2022


File: /etc/lvm/archive/vg2_00006-83642253.vg
VG name: vg2
Description: Created *before* executing '/sbin/lvcreate /dev/vg2 -n syno_vg_reserved_area --size 12M'
Backup Time: Sun Aug 28 18:10:46 2022


File: /etc/lvm/archive/vg2_00007-1711665524.vg
VG name: vg2
Description: Created *before* executing '/sbin/lvcreate /dev/vg2 -n volume_2 --size 500736M'
Backup Time: Sun Aug 28 18:12:01 2022


File: /etc/lvm/backup/vg2
VG name: vg2
Description: Created *after* executing '/sbin/lvcreate /dev/vg2 -n volume_2 --size 500736M'
Backup Time: Sun Aug 28 18:12:01 2022

 

#选择一个正确的时间点的元数据文件 通过 vgcfgrestore  f参数 进行恢复

root@DS3622:/dev/mapper# vgcfgrestore -f /etc/lvm/archive/vg2_00007-1711665524.vg vg2
Restored volume group vg2

#恢复完毕后  先把vg卷组状态改成未激活
root@DS3622:/dev/mapper# vgchange -a n vg2
0 logical volume(s) in volume group "vg2" now active

#  再把vg卷组状态改成激活状态
root@DS3622:/dev/mapper# vgchange -a y vg2
1 logical volume(s) in volume group "vg2" now active

#最后再重新挂载下
root@DS3622:/dev/mapper# mount -a
mount: /proc: none already mounted on /config.

posted @ 2022-09-10 11:55  陈参天  阅读(1038)  评论(1编辑  收藏  举报