linux LVM 逻辑卷组管理
作者 佚名技术
来源 Linux系统
浏览
发布时间 2012-03-23
0/lv0 to 204800 (1k) blocks. The filesystem on /dev/vg0/lv0 is now 204800 blocks long. 再看的话已经将分区成功扩展了.. [root@zhaoyun ~]# df -h 文件系统 容量 已用 可用 已用% 挂载点 /dev/sda1 30G 3.1G 25G 11% / tmpfs 95M 0 95M 0% /dev/shm /dev/mapper/vg0-lv0 194M 5.6M 179M 4% /mnt LVM还可以实现缩小操作,,不建议做缩小操作,只不过看看现象就行了. 将刚才194M的逻辑卷缩小到150M. 缩小不支持在线,需要先卸载掉已经挂载的逻辑卷. 1、先卸载挂载的卷 [root@zhaoyun ~]# umount /dev/vg0/lv0 2、执行检查 [root@zhaoyun ~]# e2fsck -f /dev/vg0/lv0 e2fsck 1.39 (29-May-2006) Pass 1: Checking inodes, blocks, and sizes Pass 2: Checking directory structure Pass 3: Checking directory connectivity Pass 4: Checking reference counts Pass 5: Checking group summary information /dev/vg0/lv0: 12/49400 files (8.3% non-contiguous), 11903/204800 blocks 3、重新配置卷大小,分俩步 [root@zhaoyun ~]# resize2fs /dev/vg0/lv0 150M resize2fs 1.39 (29-May-2006) Resizing the filesystem on /dev/vg0/lv0 to 153600 (1k) blocks. The filesystem on /dev/vg0/lv0 is now 153600 blocks long. [root@zhaoyun ~]# lvreduce -L 150M /dev/vg0/lv0 Rounding up size to full physical extent 152.00 MB WARNING: Reducing active logical volume to 152.00 MB THIS MAY DESTROY YOUR DATA (filesystem etc.) Do you really want to reduce lv0? [y/n]: y Reducing logical volume lv0 to 152.00 MB Logical volume lv0 successfully resized 4、重新挂载,已经重194M成功减少到146M了. [root@zhaoyun ~]# mount /dev/vg0/lv0 /mnt [root@zhaoyun ~]# df -h 文件系统 容量 已用 可用 已用% 挂载点 /dev/sda1 30G 3.1G 25G 11% / tmpfs 95M 0 95M 0% /dev/shm /dev/mapper/vg0-lv0 146M 5.6M 134M 4% /mnt [root@zhaoyun ~]# LVM快照功能,通过快照功能可以理解为备份,,就想VM虚拟机一样有一个快照的功能. [root@zhaoyun ~]# lvcreate -L 40M -s -n lv0bak /dev/vg0/lv0 Logical volume "lv0bak" created [root@zhaoyun ~]# ll /dev/vg0/lv0 lv0 lv0bak [root@zhaoyun ~]# ll /dev/vg0/lv0bak lrwxrwxrwx 1 root root 22 11-29 08:29 /dev/vg0/lv0bak -> /dev/mapper/vg0-lv0bak [root@zhaoyun ~]# [root@zhaoyun ~]# mount /dev/vg0/lv0bak /media [root@zhaoyun ~]# cd /media [root@zhaoyun media]# ls file lost found [root@zhaoyun media]# touch file2 [root@zhaoyun media]# ls file file2 lost found [root@zhaoyun media]# cd /mnt [root@zhaoyun mnt]# ls file lost found [root@zhaoyun mnt]# 删除卷组. [root@zhaoyun ~]# umount /dev/vg0/lv0 [root@zhaoyun ~]# umount /dev/vg0/lv0bak [root@zhaoyun ~]# lvremove /dev/vg0/lv0 Do you really want to remove active logical volume lv0bak? [y/n]: y Logical volume "lv0bak" successfully removed Do you really want to remove active logical volume lv0? [y/n]: y Logical volume "lv0" successfully removed [root@zhaoyun ~]# lvremove /dev/ Display all 197 possibilities? (y or n) [root@zhaoyun ~]# lvs [root@zhaoyun ~]# vgs VG #PV #LV #SN Attr VSize VFree vg0 2 0 0 wz--n- 200.00M 200.00M [root@zhaoyun ~]# vgremove vg0 Volume gr |
凌众科技专业提供服务器租用、服务器托管、企业邮局、虚拟主机等服务,公司网站:http://www.lingzhong.cn 为了给广大客户了解更多的技术信息,本技术文章收集来源于网络,凌众科技尊重文章作者的版权,如果有涉及你的版权有必要删除你的文章,请和我们联系。以上信息与文章正文是不可分割的一部分,如果您要转载本文章,请保留以上信息,谢谢! |
你可能对下面的文章感兴趣
上一篇: LAMP环境搭建安装下一篇: Linux的常用命令1
关于linux LVM 逻辑卷组管理的所有评论