前言:
而今姐妹们对“linux删除lvm分区”大约比较看重,大家都需要知道一些“linux删除lvm分区”的相关知识。那么小编同时在网络上搜集了一些有关“linux删除lvm分区””的相关资讯,希望咱们能喜欢,咱们一起来了解一下吧!4.3 离线裁剪逻辑卷
[root@localhost /]# umount /lv1[root@localhost /]# e2fsck -f /dev/vg1/lv1 检验文件系统[root@localhost /]# resize2fs /dev/vg1/lv1 2G 裁剪文件系统到2G[root@localhost /]# lvreduce /dev/vg1/lv1 -L 2G 裁剪逻辑卷[root@localhost /]# mount /dev/vg1/lv1 /lv1/ 挂载使用[root@localhost /]# df -h文件系统 容量 已用 可用 已用% 挂载点/dev/mapper/vg1-lv1 2.0G 9.0M 1.8G 1% /lv1xfs裁剪将lv2的文件系统格式化为xfs将/dev/vg1/lv2挂载到/lv2在/lv2中建立一个文件,写入内容备份数据卸载分区并裁剪逻辑卷格式化裁剪后的逻辑卷导入数据1)备份数据命令xfsdump2)备份数据[root@localhost /]# xfsdump -f /root/lv2.img /lv2#挂载点目录后面不要加"/"xfsdump: using file dump (drive_simple) strategyxfsdump: version 3.1.8 (dump format 3.0) - type ^C for status and control ============================= dump label dialog ==============================please enter label for this dump session (timeout in 300 sec) -> lv2session label entered: "lv2" --------------------------------- end dialog ---------------------------------xfsdump: level 0 dump of localhost.localdomain:/lv2xfsdump: dump date: Tue Dec 10 06:33:44 2019xfsdump: session id: 15936371-b967-4c2c-8995-49eb702792fexfsdump: session label: "lv2"xfsdump: ino map phase 1: constructing initial dump listxfsdump: ino map phase 2: skipping (no pruning necessary)xfsdump: ino map phase 3: skipping (only one dump stream)xfsdump: ino map construction completexfsdump: estimated dump size: 20800 bytes ============================= media label dialog =============================please enter label for media in drive 0 (timeout in 300 sec) -> lv2media label entered: "lv2" --------------------------------- end dialog ---------------------------------xfsdump: creating dump session media file 0 (media 0, file 0)xfsdump: dumping ino mapxfsdump: dumping directoriesxfsdump: dumping non-directory filesxfsdump: ending media filexfsdump: media file size 21016 bytesxfsdump: dump size (non-dir files) : 0 bytesxfsdump: dump complete: 14 seconds elapsedxfsdump: Dump Summary:xfsdump: stream 0 /root/lv2.img OK (success)xfsdump: Dump Status: SUCCESS3)裁剪[root@localhost ~]# umount /lv2[root@localhost ~]# lvreduce /dev/vg1/lv2 -L 100M WARNING: Reducing active logical volume to 2.00 GiB. THIS MAY DESTROY YOUR DATA (filesystem etc.)Do you really want to reduce vg01/lv01? [y/n]: y Size of logical volume vg01/lv01 changed from 7.00 GiB (1792 extents) to 2.00 GiB (512 extents). Logical volume vg01/lv01 successfully resized.4)格式化[root@localhost ~]# mkfs.xfs -f /dev/vg1/lv2[root@localhost ~]# mount /dev/vg1/lv2 /lv25)恢复数据 -f source[root@localhost ~]# xfsrestore -f /root/lv2.img /lv2...xfsrestore: Restore Status: SUCCESSroot@localhost ~]# df -h文件系统 容量 已用 可用 已用% 挂载点/dev/mapper/vg1-lv2 95M 6.0M 89M 7% /lv2[root@localhost ~]# cat /lv2/filea hahaha4.4 删除LVM
建立: 分区--PV--VG--LV--挂载--fstab(autofs)--写入数据
删除: 备份重要数据--fstab(autofs)--卸载--LV--VG--PV--分区
1 备份数据(如果有需要) 2 编辑fstab文件或者autofs服务相关文件,删除相关设置3 卸载[root@localhost ~]#umount /lv14 删除逻辑卷[root@localhost ~]#lvremove /dev/vg1/lv15 删除卷组[root@localhost ~]#vgchange -an vg1 [root@localhost ~]#vgremove vg16 删除物理卷[root@localhost ~]#pvremove /dev/sdxx7 删除分区[root@localhost ~]#fdisk /dev/sdxx[root@localhost ~]#partprobe小结
ext*离线裁剪的流程
umount--e2fsck--resize2fs--lvreduce--mount
xfs如何操作
xfsdump--umount--lvreduce--mkfs--mount--xfsrestore
删除LVM
备份--卸载--lvremove--vgchange--vgremove--pvremove
==重点:lvm的删除,数据的备份==
==难点:针对于不同类型文件系统的裁剪流程有所差异,lvm删除之前记得备份数据==
版权声明:
本站文章均来自互联网搜集,如有侵犯您的权益,请联系我们删除,谢谢。
标签: #linux删除lvm分区 #lvm 删除分区 #lv删除命令