目次

01 lvmをマウント

①スナップショット作成

# lvcreate -s -n snapshot -L 5G /dev/disk.image

# lvdisplay /dev/disk.image
  --- Logical volume ---
  LV Name                /dev/disk.image
  VG Name                dg7tv18txypm17
  LV UUID                XmLioY-vRC4-3IJo-eT4u-S6ib-z7Je-cxAAjq
  LV Write Access        read/write
  LV snapshot status     source of
                         /dev/dg7tv18txypm17/snapshot [active]
  LV Status              available
  # open                 1
  LV Size                5.00 GB
  Current LE             1280
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           253:47

②マウント

普通にマウントしようとすると、エラーがでます。

# mount /dev/dg7tv18txypm17/snapshot /mnt/
mount: you must specify the filesystem type

①mapperを作成

# kpartx -p X -a /dev/dg7tv18txypm17/snapshot

②改めてマウント

# mount /dev/mapper/snapshotp1 /mnt/

③これで中身が見れる

# ll /mnt/
total 104
dr-xr-xr-x  2 root root  4096 Jul  4  2012 bin
dr-xr-xr-x  4 root root  4096 Jul  4  2012 boot
drwxr-xr-x  2 root root  4096 Sep 24  2011 cgroup
drwxr-xr-x  2 root root  4096 Jul  4  2012 dev
drwxr-xr-x 74 root root  4096 Mar 22 14:11 etc
drwxr-xr-x  3 root root  4096 Jul  4  2012 home
dr-xr-xr-x 10 root root  4096 Jul  4  2012 lib
dr-xr-xr-x  7 root root 12288 Jul  4  2012 lib64
drwx------  2 root root 16384 Jul 12  2011 lost+found
drwxr-xr-x  2 root root  4096 Sep 23  2011 media
drwxr-xr-x  2 root root  4096 Sep 23  2011 mnt
drwxr-xr-x  3 root root  4096 Jul  4  2012 opt
drwxr-xr-x  2 root root  4096 Jul 12  2011 proc
dr-xr-x---  5 root root  4096 Mar 22 14:10 root
dr-xr-xr-x  2 root root  4096 Jul  4  2012 sbin
drwxr-xr-x  2 root root  4096 Sep 23  2011 selinux
drwxr-xr-x  2 root root  4096 Sep 23  2011 srv
drwxr-xr-x  2 root root  4096 Jul 12  2011 sys
drwxrwxrwt  3 root root  4096 Mar 22 18:02 tmp
drwxr-xr-x 13 root root  4096 Dec 12  2011 usr
drwxr-xr-x 22 root root  4096 Jul  4  2012 var

③アンマウント

# umount /mnt/
# kpartx -p X -d /dev/dg7tv18txypm17/snapshot
# lvremove /dev/dg7tv18txypm17/snapshot