快照损坏测试

# cp /etc/*.conf /mnt/

# ls /mnt/

asound.conf            latrace.conf    pm-utils-hd-apm-restore.conf

autofs_ldap_auth.conf  ld.so.conf      prelink.conf

cas.conf               libaudit.conf   readahead.conf

cgconfig.conf          libuser.conf    report.conf

cgrules.conf           logrotate.conf  request-key.conf

dnsmasq.conf           lost+found      resolv.conf

dracut.conf            ltrace.conf     rsyslog.conf

elinks.conf            mdadm.conf      sestatus.conf

fprintd.conf           mke2fs.conf     smartd.conf

gai.conf               nfsmount.conf   sos.conf

grub.conf              nscd.conf       sysctl.conf

gssapi_mech.conf       nslcd.conf      updatedb.conf

host.conf              nsswitch.conf   warnquota.conf

idmapd.conf            ntp.conf        webalizer.conf

ipsec.conf             oddjobd.conf    wvdial.conf

kdump.conf             pam_ldap.conf   yp.conf

krb5.conf              pear.conf       yum.conf

# lvcreate -L 100M -n snap_lv01 -s /dev/vg01/lv01

Logical volume "snap_lv01" created

# lvdisplay /dev/vg01/snap_lv01

--- Logical volume ---

LV Name                /dev/vg01/snap_lv01

VG Name                vg01

LV UUID                1sJBN0-7yTB-VrQ5-mO2j-gLDL-N91j-BwIOwr

LV Write Access        read/write

LV snapmntstatus     active destination for /dev/vg01/lv01 //此处指明是lv01的快照

LV Status              available

# open                 0

LV Size                1.95 GiB

Current LE             500

COW-table size         100.00 MiB

COW-table LE           25

Allocated to snapmnt 0.01%

Snapmntchunk size    4.00 KiB

Segments               1

Allocation             inherit

Read ahead sectors     auto

- currently set to     256

Block device           253:3

 

挂载到

# mount /dev/vg01/lv01 /media/

# ls /media/

asound.conf            latrace.conf    pm-utils-hd-apm-restore.conf

autofs_ldap_auth.conf  ld.so.conf      prelink.conf

cas.conf               libaudit.conf   readahead.conf

cgconfig.conf          libuser.conf    report.conf

cgrules.conf           logrotate.conf  request-key.conf

dnsmasq.conf           lost+found      resolv.conf

dracut.conf            ltrace.conf     rsyslog.conf

elinks.conf            mdadm.conf      sestatus.conf

fprintd.conf           mke2fs.conf     smartd.conf

gai.conf               nfsmount.conf   sos.conf

grub.conf              nscd.conf       sysctl.conf

gssapi_mech.conf       nslcd.conf      updatedb.conf

host.conf              nsswitch.conf   warnquota.conf

idmapd.conf            ntp.conf        webalizer.conf

ipsec.conf             oddjobd.conf    wvdial.conf

kdump.conf             pam_ldap.conf   yp.conf

krb5.conf              pear.conf       yum.conf

内容和原来的LVM的内容一样,创建的LVM只有100M如果内容超过100M的话就会是快照损坏,卸载快照后快照就不能使用了。下面就用dd写入一个120M的文件,看看

 

# dd if=/dev/zero of=/mnt/dd.test bs=1M count=120

记录了120+0 的读入

记录了120+0 的写出

125829120字节(126 MB)已复制,9.42529 秒,13.4 MB/

 

# lvdisplay

--- Logical volume ---

LV Name                /dev/vg01/lv01

VG Name                vg01

LV UUID                XVwDf2-HDDR-rEox-AK77-dcLQ-73JS-5AOBZR

LV Write Access        read/write

LV snapmntstatus     source of

/dev/vg01/snap_lv01 [INACTIVE]  //不能使用了

LV Status              available

# open                 1

LV Size                1.95 GiB

Current LE             500

Segments               1

Allocation             inherit

Read ahead sectors     auto

- currently set to     256

Block device           253:2

 

--- Logical volume ---

LV Name                /dev/vg01/snap_lv01

VG Name                vg01

LV UUID                1sJBN0-7yTB-VrQ5-mO2j-gLDL-N91j-BwIOwr

LV Write Access        read/write

LV snapmntstatus     INACTIVE destination for /dev/vg01/lv01

LV Status              available

# open                 0

LV Size                1.95 GiB

Current LE             500

COW-table size         100.00 MiB

COW-table LE           25

Snapmntchunk size    4.00 KiB

Segments               1

Allocation             inherit

Read ahead sectors     auto

- currently set to     256

Block device           253:3

# umount /media/       //卸载快照

# mount /dev/vg01/snap_lv01 /media/         //在挂载

mount: you must specify the filesystem type               // 已经不能使用