linux 逻辑卷管理 调整分区大小例子
2019/10/10/17:46:19 阅读:1909 来源:谷歌SEO算法 标签:
5G标准出炉
文章就是一个关于linux 逻辑卷管理 调整分区大小例子,我们只要按下面代码操作就完成100%完成逻辑卷管理 调整分区大小了.
测试机各种报错,创建个目录都报错,df看了一下,发现VolGroup-lv_root 100%,虚拟磁盘满了,怎么办呢.
1,解决过程
- #df-h//查看分区
- #umount/home//取消挂载
- #e2fsck-f/dev/mapper/VolGroup-lv_home//分区检测
- #resize2fs-p/dev/mapper/VolGroup-lv_home100G//将lv_home虚拟分区设为100G
- #mount/home//挂载home
- #df-h//查看分区
- #lvreduce-L100G/dev/mapper/VolGroup-lv_home//释放空间
- #vgdisplay//查看可用空间大小
- #lvextend-L+311.47G/dev/mapper/VolGroup-lv_root//扩展lv_root虚拟分区
- #resize2fs-p/dev/mapper/VolGroup-lv_root//lv_root重设分区大小
- LVM(逻辑磁盘管理),灵活性很高.
2,详细解决过程
- [root@localhost~]#df-h
- FilesystemSizeUsedAvailUse%Mountedon
- /dev/mapper/VolGroup-lv_root50G47G16M100%///lv_root满了
- tmpfs1.9G72K1.9G1%/dev/shm
- /dev/sda1485M40M420M9%/boot
- /dev/mapper/VolGroup-lv_home406G19G366G5%/home//lv_home空间很多
- [root@localhost~]#resize2fs-p/dev/mapper/VolGroup-lv_home100G
- resize2fs1.41.12(17-May-2010)
- Filesystemat/dev/mapper/VolGroup-lv_homeismountedon/home;on-lineresizingrequired
- On-lineshrinkingfrom107865088to65536000notsupported.//先umount才能resize2fs
- [root@localhost~]#umount/home//umounthome目录
- [root@localhost~]#resize2fs-p/dev/mapper/VolGroup-lv_home100G
- resize2fs1.41.12(17-May-2010)
- 请先运行'e2fsck-f/dev/mapper/VolGroup-lv_home'.//提示要先进行磁盘检测
- [root@localhost~]#e2fsck-f/dev/mapper/VolGroup-lv_home
- e2fsck1.41.12(17-May-2010)
第一步:检查inode,块,和大小
第二步:检查目录结构
第3步:检查目录连接性
Pass 4:Checking reference counts
第5步:检查簇概要信息
- /dev/mapper/VolGroup-lv_home:1459/16384000files(4.0%non-contiguous),5914204/65536000blocks
- [root@localhost~]#resize2fs-p/dev/mapper/VolGroup-lv_home100G//重定大小
- resize2fs1.41.12(17-May-2010)
- Resizingthefilesystemon/dev/mapper/VolGroup-lv_hometo26214400(4k)blocks.
- Beginpass2(max=32768)
正在重定位块 XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Begin pass 3 (max = 2000)
正在扫描inode表 XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
- Thefilesystemon/dev/mapper/VolGroup-lv_homeisnow26214400blockslong.
- [root@localhost~]#mount/home/
- [root@localhost~]#df-h
- FilesystemSizeUsedAvailUse%Mountedon
- /dev/mapper/VolGroup-lv_root50G47G16M100%/
- tmpfs1.9G72K1.9G1%/dev/shm
- /dev/sda1485M40M420M9%/boot
- /dev/mapper/VolGroup-lv_home99G19G75G20%/home
- [root@localhost~]#lvreduce-L100G/dev/mapper/VolGroup-lv_home//释放空间
- WARNING:Reducingactiveandopenlogicalvolumeto100.00GiB
- THISMAYDESTROYYOURDATA(filesystemetc.)
- Doyoureallywanttoreducelv_home?[y/n]:y
- Reducinglogicalvolumelv_hometo100.00GiB
- Logicalvolumelv_homesuccessfullyresized
- [root@localhost~]#df-h
- FilesystemSizeUsedAvailUse%Mountedon
- /dev/mapper/VolGroup-lv_root50G47G16M100%/
- tmpfs1.9G72K1.9G1%/dev/shm
- /dev/sda1485M40M420M9%/boot
- /dev/mapper/VolGroup-lv_home99G19G75G20%/home
- [root@localhost~]#vgdisplay
- ---Volumegroup---
- VGNameVolGroup
- SystemID
- Formatlvm2
- MetadataAreas1
- MetadataSequenceNo5
- VGAccessread/write
- VGStatusresizable
- MAXLV0
- CurLV3
- OpenLV3
- MaxPV0
- CurPV1
- ActPV1
- VGSize465.27GiB
- PESize4.00MiB
- TotalPE119109
- AllocPE/Size39372/153.80GiB
- FreePE/Size79737/311.47GiB//空闲空间
- VGUUIDVt2V4t-Byxs-tQqk-cY0h-IDE3-pabX-LUfkRS
- [root@localhost~]#lvextend-L+311.47G/dev/mapper/VolGroup-lv_root//空闲空间加入到lv_root
- Roundingsizetoboundarybetweenphysicalextents:311.47GiB
- Extendinglogicalvolumelv_rootto361.47GiB
- Logicalvolumelv_rootsuccessfullyresized
- [root@localhost~]#resize2fs-p/dev/mapper/VolGroup-lv_root
- resize2fs1.41.12(17-May-2010)
- Filesystemat/dev/mapper/VolGroup-lv_rootismountedon/;on-lineresizingrequired
- olddesc_blocks=4,new_desc_blocks=23//这儿要耐心等待,扩大越多,时间越长
- Performinganon-lineresizeof/dev/mapper/VolGroup-lv_rootto94757888(4k)blocks.
- Thefilesystemon/dev/mapper/VolGroup-lv_rootisnow94757888blockslong.
- [root@localhostopenfire]#df-h
- FilesystemSizeUsedAvailUse%Mountedon
- /dev/mapper/VolGroup-lv_root356G48G308G14%/
- tmpfs1.9G72K1.9G1%/dev/shm
- /dev/sda1485M40M420M9%/boot
- /dev/mapper/VolGroup-lv_home99G19G75G20%/home
热门评论