LVM-COW写实备份

Posted luoyan01

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了LVM-COW写实备份相关的知识,希望对你有一定的参考价值。


[[email protected] ~]# fdisk -l /dev/sdb /dev/sdc | grep "LVM"
/dev/sdb1 1 9660 77593918+ 8e Linux LVM
/dev/sdc1 1 9660 77593918+ 8e Linux LVM
创建物理卷:
[[email protected] ~]# pvcreate /dev/sdb1
Physical volume "/dev/sdb1" successfully created
[[email protected] ~]# pvcreate /dev/sdc1
Physical volume "/dev/sdc1" successfully created
创建卷组:
[[email protected] ~]# vgcreate mail_store /dev/sdb1 /dev/sdc1
Volume group "mail_store" successfully created
创建逻辑卷:
[[email protected] ~]# lvcreate -L 60G -n mail mail_store
Logical volume "mail" created
[[email protected] ~]# mkfs -t ext4 /dev/mail_store/mail
……
逻辑卷扩容:
[[email protected] ~]# lvextend -L +10G /dev/mail_store/mail
[[email protected] ~]# resize2fs /dev/mail_store/mail (物理分区或者挂在点都可)
如果本身VG不够大,也可以扩大VG
[[email protected] ~]# vgextend mail_store(扩大谁) /dev/vda5(从哪扩大)
逻辑卷减小:
[[email protected] ~]# umount /media
[[email protected] ~]# resize2fs -p -d 2 /dev/mail_store/mail 1G (缩小1G)
[[email protected] ~]# e2fsck -f /dev/dev/mail_store/mail (缩小前检查磁盘)
[[email protected] ~]# lvreduce -L 1G /dev/mail_store/mail
[[email protected] ~]# lvchange -an /dev/mail_store/mail (下线)
[[email protected] ~]# lvchange -ay /dev/mail_store/mail (生产模式)
[[email protected] ~]# mount -a (重新挂载)
逻辑卷快照:
[[email protected] ~]# umount /media/
[[email protected] ~]# lvcreate -s -L 100M -n homebak /dev/vgsrv/home(对谁备份)
--------lvs 会多出来一个homebak
[[email protected] ~]# mkdir /mnt/homebak
[[email protected] ~]# mount -o ro /dev/vgsrv/home /mnt/homebak
--------修改home目录
[[email protected] ~]# tar zcvf /backup/homebak.tar.gz /mnt/homebak
[[email protected] ~]# umount /mnt/homebak
[[email protected] ~]# lvremove /dev/vgsrv/home








































以上是关于LVM-COW写实备份的主要内容,如果未能解决你的问题,请参考以下文章

增量备份与完全备份的区别?

完整备份增量备份差异备份

完全备份差异备份以及增量备份的区别

Rsync 的备份

SQL Server备份恢复维护计划实现备份:每周数据库完整备份每天差异备份每小时日志备份

完全备份,增量备份,差异备份及恢复区别