您好,登录后才能下订单哦!
这篇文章主要讲解了“CentOS下怎么把home空间的分出来给root”,文中的讲解内容简单清晰,易于学习与理解,下面请大家跟着小编的思路慢慢深入,一起来研究和学习“CentOS下怎么把home空间的分出来给root”吧!
下面的例子尝试吧home空间的20G中的5G分出来给root空间
[root@localhost ~]# df -h
文件系统 容量 已用 可用 已用%% 挂载点
/dev/mapper/VolGroup-lv_root
75G 50G 22G 70% /
tmpfs 3.9G 88K 3.9G 1% /dev/shm
/dev/sda1 485M 30M 430M 7% /boot
/dev/mapper/VolGroup-lv_home
20G 174M 19G 1% /home
[root@localhost ~]# umount /home
[root@localhost ~]# e2fsck -f/dev/mapper/VolGroup-lv_home
e2fsck 1.41.12 (17-May-2010)
第1步: 检查inode,块,和大小
第2步: 检查目录结构
第3步: 检查目录连接性
Pass 4: Checking reference counts
第5步: 检查簇概要信息
/dev/mapper/VolGroup-lv_home: 158/1310720files (0.0% non-contiguous), 126581/5242880 blocks
[root@localhost ~]# resize2fs -p/dev/mapper/VolGroup-lv_home 15G
resize2fs 1.41.12 (17-May-2010)
Resizing the filesystem on/dev/mapper/VolGroup-lv_home to 3932160 (4k) blocks.
Begin pass 3 (max = 160)
正在扫描inode表 XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
The filesystem on/dev/mapper/VolGroup-lv_home is now 3932160 blocks long.
[root@localhost ~]# mount /home
[root@localhost ~]# df -h
文件系统 容量 已用 可用 已用%% 挂载点
/dev/mapper/VolGroup-lv_root
75G 50G 22G 70% /
tmpfs 3.9G 88K 3.9G 1% /dev/shm
/dev/sda1 485M 30M 430M 7% /boot
/dev/mapper/VolGroup-lv_home
15G 170M 14G 2% /home
[root@localhost ~]# lvreduce -L 15G /dev/mapper/VolGroup-lv_home
WARNING: Reducing active and open logical volume to 15.00 GiB
THIS MAY DESTROY YOUR DATA (filesystem etc.)
Do you really want to reduce lv_home?[y/n]: y
Reducing logical volume lv_home to 15.00 GiB
Logical volume lv_home successfully resized
[root@localhost ~]# vgdisplay
---Volume group ---
VGName VolGroup
System ID
Format lvm2
Metadata Areas 1
Metadata Sequence No 7
VGAccess read/write
VGStatus resizable
MAXLV 0
CurLV 3
Open LV 3
MaxPV 0
CurPV 1
ActPV 1
VGSize 99.51 GiB
PESize 4.00 MiB
Total PE 25474
Alloc PE / Size 24194 /94.51 GiB
Free PE / Size 1280 / 5.00 GiB
VGUUID cxzV5u-cG1f-HvPd-pE8c-eKrR-dBjN-H07k3I
[root@localhost ~]# lvextend -L +5.00G/dev/mapper/VolGroup-lv_root
Extending logical volume lv_root to 80.57 GiB
Logical volume lv_root successfully resized
[root@localhost ~]# resize2fs -p/dev/mapper/VolGroup-lv_root
resize2fs 1.41.12 (17-May-2010)
Filesystem at /dev/mapper/VolGroup-lv_rootis mounted on /; on-line resizing required
old desc_blocks = 5, new_desc_blocks = 6
Performing an on-line resize of/dev/mapper/VolGroup-lv_root to 21121024 (4k) blocks.
The filesystem on/dev/mapper/VolGroup-lv_root is now 21121024 blocks long.
[root@localhost ~]# df -h
文件系统 容量 已用 可用 已用%% 挂载点
/dev/mapper/VolGroup-lv_root
80G 50G 27G 66% /
tmpfs 3.9G 88K 3.9G 1% /dev/shm
/dev/sda1 485M 30M 430M 7% /boot
/dev/mapper/VolGroup-lv_home
15G 170M 14G 2% /home
感谢各位的阅读,以上就是“CentOS下怎么把home空间的分出来给root”的内容了,经过本文的学习后,相信大家对CentOS下怎么把home空间的分出来给root这一问题有了更深刻的体会,具体使用情况还需要大家实践验证。这里是亿速云,小编将为大家推送更多相关知识点的文章,欢迎关注!
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。