一、快照
[root@localhost backup]# lvcreate -l 10 -s -n lv-kz /dev/vg1/lv1-backup //建立一个快照,-l 10指定用10个PE,-s 指定为快照,-n指定快照名称,最后跟LV名称。
Logical volume "lv-kz" created
[root@localhost backup]# mount /dev/vg1/lv-kz /tmp/ //挂载快照到目录
[root@localhost backup]# cd /tmp/ //发现内容正是当前LV的内容。
[root@localhost tmp]# ls
lost+found test test2 test3 test4
[root@localhost tmp]# ls /backup/
lost+found test test2 test3 test4
[root@localhost /]#umount /tmp/
[root@localhost /]# lvremove /dev/vg1/lv-kz
Do you really want to remove active logical volume lv-kz? [y/n]: y
Logical volume "lv-kz" successfully removed
二、自动挂载
vi /etc/fstab //新增下面内容
#UUID=YR67fr-n5ze-EfSx-TgKf-2099-UFdi-vHOcZU /backup ext4 defaults 0 0 //用UUID
/dev/vg1/lv1-backup /backup ext4 defaults 0 0 //用dev方式
三、删除LVM
[root@localhost /]# mount //查看LV是否挂载,如果有挂载一定要先umount
/dev/sda2 on / type ext4 (rw)
proc on /proc type proc (rw)
sysfs on /sys type sysfs (rw)
devpts on /dev/pts type devpts (rw,gid=5,mode=620)
tmpfs on /dev/shm type tmpfs (rw,rootcontext="system_u:object_r:tmpfs_t:s0")
/dev/sda1 on /boot type ext4 (rw)
/dev/mapper/vg1-lv1--backup on /backup type ext4 (rw)
none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)
sunrpc on /var/lib/nfs/rpc_pipefs type rpc_pipefs (rw)
/dev/mapper/vg1-lvtest on /tmp type ext4 (rw)
[root@localhost /]# umount /tmp/
[root@localhost /]# lvremove /dev/vg1/lvtest //移除LV
Do you really want to remove active logical volume lvtest? [y/n]: y
Logical volume "lvtest" successfully removed
[root@localhost ~]# vgchange -an /dev/vg2 //设置VG为休眠状态
0 logical volume(s) in volume group "vg2" now active
[root@localhost ~]# vgremove /dev/vg2 //移除 VG
Volume group "vg2" successfully removed
[root@localhost ~]# pvremove /dev/sda4 //移除PV
Labels on physical volume "/dev/sda4" successfully wiped
到此就可以用fdisk 删除分区。注意要将分区里的资料保存。