VirtualBox如何增加CentOS根目录容量

 

 

1.扩充磁盘容量

单位为M,40000为40G

VBoxManage modifyhd centos.vdi --resize 40000

 

2.指定新的磁盘文件

系统 > 右击 > 设置 > 存储 > 控制器SATA,选择新的文件.

 

 

3.逻辑卷扩展(LVM)

fdisk -l

 

只有sda1,sda2.通过fdisk /dev/sda进行分区。

 

mkfs.ext4 /dev/sda4

 如果不成功的话,需要重新启动虚拟机器在mkfs.

 

 

查看卷组名

vgdisplay

 

 

 

pvcreate /dev/sda4                // 创建新物理卷
vgextend cl /dev/sda4       // 扩展到卷组

 

 

查看根分区

lvdisplay

 

 

 

扩展容量

 

lvextend /dev/cl/root /dev/sda4

resize2fs /dev/cl/root     // 刷新逻辑分区容量(CentOS 6的版本用这个命令)

xfs_growfs
/dev/cl/root (CentOS 7以后用这个命令)
df -h  // 会发现根分区,现在容量翻倍了。。。

 

 

 

 

扩容成功后reboot.

 

CentOS Virtualbox虚拟环境因为运行过程中移动硬盘松动导致启动出错

出错信息

fail to mount /sysroot

         Starting Emergency Shell...

Genrating "/run/initramfs/rdsosreport.txt"

Entering emergancy mode. Exit the shell to continue.
Type "journalctl" to view system logs.
You might want to save "/run/initramfs/rdsosreport.txt" to usb stick or /boot
after mounting them and attach it to a bug report.

解决方法:

运行
sudo xfs_repair -v -L /dev/dm-0

 

 

 

转载于:https://www.cnblogs.com/ericnie/p/6815872.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值