Mount Snapshot created with DiskSafe in CentOS7

Please refer to the steps below on how to Mount Snapshot created with DiskSafe in CentOS7

List all the availble snapshot and record down the timestamp ID

[root@centos7 ~]# dscli snapshot list sda
All snapshots of sda

Snapshot 1:
    Snapshot Timestamp    = 1535448502(2018/08/28 17:28:22)
    Snapshot Blocks Count = 6299648
    Mounted               = NO

Snapshot 2:
    Snapshot Timestamp    = 1535450090(2018/08/28 17:54:50)
    Snapshot Blocks Count = 386924544
    Mounted               = NO

Snapshot 3:
    Snapshot Timestamp    = lsblk(2018/08/28 18:54:56)
    Snapshot Blocks Count = 65536
    Mounted               = NO

Snapshot count : 3

Mount the snapshot and record down the snapshot device name /dev/sde

[root@centos7 ~]# dscli snapshot mount sda timestamp=1535453696
Mount snapshot with timestamp 1535453696 of sda

Snapshot mounted, get the information...

Snapshot device name: /dev/sde
Command succeeded

add “a|^/dev/sde2$|” in global_filter in /etc/lvm/lvm.conf to allow vgscan to discover the newly added /dev/sde device

vi /etc/lvm/lvm.conf 

    # Accept every block device:
    global_filter = [ "a|^/dev/disksafe/sda$|",  "a|^/dev/disksafe/sda2$|", "a|^/dev/sde2$|", "r|.*|" ]

We manage to see the snapshot now, but we need to resolve the deplicate PVs issue – PV GYQLfY-9Is6-SNqD-gvAx-PyTB-ihv9-w5X95l on /dev/sde2 was already found on /dev/disksafe/sda2 to allow it to be mounted in later stage

[root@centos7 lvm]# pvdisplay
  WARNING: PV GYQLfY-9Is6-SNqD-gvAx-PyTB-ihv9-w5X95l on /dev/sde2 was already found on /dev/disksafe/sda2.
  WARNING: Disabling lvmetad cache which does not support duplicate PVs.
  WARNING: Not using lvmetad because duplicate PVs were found.
  WARNING: Use multipath or vgimportclone to resolve duplicate PVs?
  WARNING: After duplicates are resolved, run "pvscan --cache" to enable lvmetad.
  WARNING: PV GYQLfY-9Is6-SNqD-gvAx-PyTB-ihv9-w5X95l on /dev/sde2 was already found on /dev/disksafe/sda2.
  WARNING: PV GYQLfY-9Is6-SNqD-gvAx-PyTB-ihv9-w5X95l prefers device /dev/disksafe/sda2 because                                                                                     device is used by LV.
  --- Physical volume ---
  PV Name               /dev/disksafe/sda2
  VG Name               centos
  PV Size               <9.00 GiB / not usable 3.00 MiB
  Allocatable           yes (but full)
  PE Size               4.00 MiB
  Total PE              2303
  Free PE               0
  Allocated PE          2303
  PV UUID               GYQLfY-9Is6-SNqD-gvAx-PyTB-ihv9-w5X95l

Resolved the Duplicate PV issue and a new VG – centos11 is show in /dev/sde2 (PV) now

[root@centos7 lvm]# vgimportclone /dev/sde2
  WARNING: PV GYQLfY-9Is6-SNqD-gvAx-PyTB-ihv9-w5X95l on /dev/sde2 was already found on /dev/disksafe/sda2.
  WARNING: PV GYQLfY-9Is6-SNqD-gvAx-PyTB-ihv9-w5X95l prefers device /dev/disksafe/sda2 because device is used by LV.
[root@centos7 lvm]# vgimportclone /dev/sde2
[root@centos7 lvm]# pvdisplay
  --- Physical volume ---
  PV Name               /dev/sde2
  VG Name               centos11
  PV Size               <9.00 GiB / not usable 3.00 MiB
  Allocatable           yes (but full)
  PE Size               4.00 MiB
  Total PE              2303
  Free PE               0
  Allocated PE          2303
  PV UUID               Om09CY-VONn-pTZY-erVN-XqrL-wVlr-ITfb3T

  --- Physical volume ---
  PV Name               /dev/disksafe/sda2
  VG Name               centos
  PV Size               <9.00 GiB / not usable 3.00 MiB
  Allocatable           yes (but full)
  PE Size               4.00 MiB
  Total PE              2303
  Free PE               0
  Allocated PE          2303
  PV UUID               GYQLfY-9Is6-SNqD-gvAx-PyTB-ihv9-w5X95l

Rescan the VG & LV

[root@centos7 lvm]# vgscan
  Reading volume groups from cache.
  Found volume group "centos11" using metadata type lvm2
  Found volume group "centos" using metadata type lvm2

[root@centos7 lvm]# lvscan
  inactive          '/dev/centos11/swap' [1.00 GiB] inherit
  inactive          '/dev/centos11/root' [<8.00 GiB] inherit
  ACTIVE            '/dev/centos/swap' [1.00 GiB] inherit
  ACTIVE            '/dev/centos/root' [<8.00 GiB] inherit

Activate the LV that we would like to mount manually

[root@centos7 lvm]# lvchange -ay /dev/centos11/root
[root@centos7 lvm]# lvscan
  inactive          '/dev/centos11/swap' [1.00 GiB] inherit
  ACTIVE            '/dev/centos11/root' [<8.00 GiB] inherit
  ACTIVE            '/dev/centos/swap' [1.00 GiB] inherit
  ACTIVE            '/dev/centos/root' [<8.00 GiB] inherit

If you try to mount the new LV – /dev/centos11/root, you will get the duplicate UUID error as below

[root@centos7 lvm]# mount /dev/centos11/root /mnt
mount: wrong fs type, bad option, bad superblock on /dev/mapper/centos11-root,
       missing codepage or helper program, or other error

       In some cases useful info is found in syslog - try
       dmesg | tail or so.

[root@centos7]dmesg
[10811.766108] XFS (dm-4): Filesystem has duplicate UUID 0623d025-0721-419a-8ce2-e8e9adc318d3

Mount the volume without UUID specified

[root@centos7 /]# mount -o nouuid /dev/centos11/root /mnt
[root@centos7 /]# ls /mnt
bin   dev       etc   jcameron-key.asc  lib64  mnt  proc  run   srv  tmp  var
boot  disksafe  home  lib               media  opt  root  sbin  sys  usr

The snapshot is mounted successfully now, and you can look for the files you want for recovery purpose

Once you done for recovery, and you can release the snapshot mounted

[root@centos7 /]# umount /mnt
[root@centos7 /]# dscli snapshot unmount sda timestamp=1535453696
Dismount snapshot with timestamp 1535453696 of sda

Command succeeded

[root@centos7 /]# lsblk
NAME            MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
sda               8:0    0   10G  0 disk
├─sda1            8:1    0    1G  0 part
└─sda2            8:2    0    9G  0 part
sdb               8:16   0   20G  0 disk
├─sdb1            8:17   0    1G  0 part
└─sdb2            8:18   0    9G  0 part
sr0              11:0    1 1024M  0 rom
disksafe!sda    188:0    0   10G  0 disk
├─disksafe!sda1 188:1    0    1G  0 part /boot
└─disksafe!sda2 188:2    0    9G  0 part
  ├─centos-swap 253:0    0    1G  0 lvm  [SWAP]
  └─centos-root 253:1    0    8G  0 lvm  /

Mouted Snapshot had been released successfully

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top