1.扩充磁盘容量加粗样式
单位为M,40000为40G
VBoxManage modifyhd centos.vdi --resize 40000 |
---|
说明:在windows的doc下进入到VirtualBox(根据你的VirtualBox存的位置)。。
然后执行 VBoxManage modifyhd + 你的 centos.vdi 的路径
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 | |
---|---|
加粗样式