[实验]通过LVM快照进行热备(2)

Logical volume "lv1_sp" created
[root@station122 mnt]#
[root@station122 mnt]# lvs
  LV      VG       Attr   LSize   Origin Snap%  Move Log Copy%  Convert
  lv_home VolGroup -wi-ao  28.54g
  lv_root VolGroup -wi-ao  50.00g
  lv_swap VolGroup -wi-ao 992.00m
  lv1     vg1      owi-ao  20.00m
  lv1_sp  vg1      swi-a-   8.00m lv1      0.15
[root@station122 mnt]# mkdir /mnt/lv1_sp
[root@station122 mnt]# mount /dev/vg1/lv1_sp /mnt/lv1_sp/ #挂载快照,注意我们并没有为该快照创建文件系统
[root@station122 mnt]# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/VolGroup-lv_root
                       50G  884M   46G   2% /
tmpfs                 120M     0  120M   0% /dev/shm
/dev/sda1             485M   29M  431M   7% /boot
/dev/mapper/VolGroup-lv_home
                       29G  172M   27G   1% /home
/dev/sr0              3.2G  3.2G     0 100% /media
/dev/mapper/vg1-lv1    20M  1.2M   18M   7% /mnt/lv1
/dev/mapper/vg1-lv1_sp
                       20M  1.2M   18M   7% /mnt/lv1_sp
[root@station122 mnt]# cd /boot/
[root@station122 boot]# ll -h
total 18M
-rw-r--r--. 1 root root  96K Sep  1  2010 config-2.6.32-71.el6.x86_64
drwxr-xr-x. 3 root root 1.0K Mar 28 10:00 efi
drwxr-xr-x. 2 root root 1.0K Mar 28 10:03 grub
-rw-r--r--. 1 root root  12M Mar 28 10:02 initramfs-2.6.32-71.el6.x86_64.img
drwx------. 2 root root  12K Mar 28 09:55 lost+found
-rw-r--r--. 1 root root 157K Sep  1  2010 symvers-2.6.32-71.el6.x86_64.gz
-rw-r--r--. 1 root root 2.2M Sep  1  2010 System.map-2.6.32-71.el6.x86_64
-rwxr-xr-x. 1 root root 3.7M Sep  1  2010 vmlinuz-2.6.32-71.el6.x86_64
[root@station122 boot]# cp vmlinuz-2.6.32-71.el6.x86_64 /mnt/lv1/ #模拟系统运行,往lvm写入3.7M数据
[root@station122 boot]# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/VolGroup-lv_root
                       50G  884M   46G   2% /
tmpfs                 120M     0  120M   0% /dev/shm
/dev/sda1             485M   29M  431M   7% /boot
/dev/mapper/VolGroup-lv_home
                       29G  172M   27G   1% /home
/dev/sr0              3.2G  3.2G     0 100% /media
/dev/mapper/vg1-lv1    20M  4.8M   14M  27% /mnt/lv1
/dev/mapper/vg1-lv1_sp
                       20M  1.2M   18M   7% /mnt/lv1_sp
[root@station122 boot]# lvs #快照已占用46.09%
  LV      VG       Attr   LSize   Origin Snap%  Move Log Copy%  Convert
  lv_home VolGroup -wi-ao  28.54g
  lv_root VolGroup -wi-ao  50.00g
  lv_swap VolGroup -wi-ao 992.00m
  lv1     vg1      owi-ao  20.00m
  lv1_sp  vg1      swi-ao   8.00m lv1     46.09
[root@station122 boot]# cat /mnt/lv1_sp/passwd | wc -l  #模拟快照备份,此处仍可以读取
20
[root@station122 boot]# cp initramfs-2.6.32-71.el6.x86_64.img /mnt/lv1/ #再往lvm写入一个12M的文件,超出快照大小8M
[root@station122 boot]# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/VolGroup-lv_root
                       50G  884M   46G   2% /
tmpfs                 120M     0  120M   0% /dev/shm
/dev/sda1             485M   29M  431M   7% /boot
/dev/mapper/VolGroup-lv_home
                       29G  172M   27G   1% /home
/dev/sr0              3.2G  3.2G     0 100% /media
/dev/mapper/vg1-lv1    20M   17M  1.8M  91% /mnt/lv1
/dev/mapper/vg1-lv1_sp
                       20M  1.2M   18M   7% /mnt/lv1_sp
[root@station122 boot]# lvs #快照占用100%
  LV      VG       Attr   LSize   Origin Snap%  Move Log Copy%  Convert
  lv_home VolGroup -wi-ao  28.54g
  lv_root VolGroup -wi-ao  50.00g
  lv_swap VolGroup -wi-ao 992.00m
  lv1     vg1      owi-ao  20.00m
  lv1_sp  vg1      Swi-Io   8.00m lv1    100.00
[root@station122 boot]# cd /mnt/lv1 #lvm还有空间
[root@station122 lv1]# du -sh
16M     .
[root@station122 boot]# cat /mnt/lv1_sp/passwd | wc -l #lvm快照已不可读取,有时仍可读取,不知何故?
cat: /mnt/lv1_sp/passwd: Input/output error
0
[root@station122 lv1_sp]# du -sh #至快照目录执行du命令会报错
du: cannot access `./.vmlinuz-2.6.32-71.el6.x86_64.hmac': Input/output error
3.0K 

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:http://www.heiqu.com/02c143669c882981c85aa13641981364.html