LVM
Posted dinghailong128
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了LVM相关的知识,希望对你有一定的参考价值。
[root@localhost ~]# ls -l /dev/sd*
[root@localhost ~]# pvcreate /dev/sdb
[root@localhost ~]# pvcreate /dev/sdc
[root@localhost ~]# vgcreate xiaoguo /dev/sdb /dev/sdc
[root@localhost ~]# lvcreate -n haha -l 100 xiaoguo
[root@localhost ~]# mkfs.ext4 /dev/xiaoguo/haha
[root@localhost ~]# mkdir /haha
[root@localhost ~]# mount /dev/xiaoguo/haha /haha/
[root@localhost ~]# vim /etc/fstab
[root@localhost ~]# df -h
扩容:
[root@localhost ~]# umount /haha
[root@localhost ~]# lvextend -L 800M /dev/xiaoguo/haha
[root@localhost ~]# e2fsck -f /dev/xiaoguo/haha
[root@localhost ~]# resize2fs /dev/xiaoguo/haha
[root@localhost ~]# mount -a
[root@localhost ~]# df –h
缩容:
[root@localhost ~]# umount /haha
[root@localhost ~]# e2fsck -f /dev/xiaoguo/haha
[root@localhost ~]# resize2fs /dev/xiaoguo/haha 300M
[root@localhost ~]# lvreduce -L 300M /dev/xiaoguo/haha
[root@localhost ~]# mount -a
[root@localhost ~]# df –h
快照:
[root@localhost ~]# cd /haha/
[root@localhost haha]# cp -rf /etc/* ./
[root@localhost haha]# ls
[root@localhost haha]# lvcreate -L 300M -s -n SNAP /dev/xiaoguo/haha
[root@localhost haha]# lvdisplay
[root@localhost haha]# ls
[root@localhost haha]# rm -rf *
[root@localhost haha]# ls
[root@localhost haha]# cd ~
[root@localhost ~]# umount /haha
[root@localhost ~]# lvconvert --merge /dev/xiaoguo/SNAP
[root@localhost ~]# mount -a
[root@localhost ~]# ls
删除:
[root@localhost ~]# umount /haha
[root@localhost ~]# vim /etc/fstab
[root@localhost ~]# lvremove /dev/xiaoguo/haha
[root@localhost ~]# vgremove xiaoguo
[root@localhost ~]# pvremove /dev/sdb
[root@localhost ~]# pvremove /dev/sdc
以上是关于LVM的主要内容,如果未能解决你的问题,请参考以下文章