virtualbox扩展磁盘

使用virtualbox搭建虚拟机,如果磁盘不够用了,可以通过以下方式扩展。

扩容磁盘

分区扩展

查看磁盘情况

fdisk -l

Disk /dev/sda: 107.4 GB, 107374182400 bytes, 209715200 sectors

Units = sectors of 1 * 512 = 512 bytes

Sector size (logical/physical): 512 bytes / 512 bytes

I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk label type: dos

Disk identifier: 0x000a391a

Device Boot Start End Blocks Id System

/dev/sda1 * 2048 2099199 1048576 83 Linux

/dev/sda2 2099200 83886079 40893440 8e Linux LVM

Disk /dev/mapper/centos-root: 37.6 GB, 37576769536 bytes, 73392128 sectors

Units = sectors of 1 * 512 = 512 bytes

Sector size (logical/physical): 512 bytes / 512 bytes

I/O size (minimum/optimal): 512 bytes / 512 bytes

扩展分区

bash 复制代码
fdisk /dev/sda
# 删除分区
d
2
# 新建分区
n
p
# 修改分区类型为 Linux LVM
t
2
8e
# 保存分区
w

扩展LVM

bash 复制代码
# 扩展物理卷到整个磁盘大小
sudo pvresize /dev/sda2
# 确认物理卷现在显示新的大小
pvdisplay

# 查看卷组
vgdisplay
# 查看当前逻辑卷
lvdisplay
# 扩展根逻辑卷
lvextend -l +100%FREE /dev/centos/root

# 扩展文件系统,ext4用resize2fs, xfs用xfs_growfs,可以用df -T查看
sudo resize2fs /dev/centos/root
sudo xfs_growfs /
相关推荐
疯狂吧小飞牛19 分钟前
ip rule 策略路由
linux·网络·tcp/ip·运维开发
小醉你真好6 小时前
17、Centos9 安装 1Panel
linux·docker·运维开发
UpYoung!1 天前
技术贴!【谷歌浏览器】实用工具推荐之谷歌浏览器(Google Chrome)离线纯净版完全安装指南:告别广告与捆绑骚扰
chrome·运维开发·谷歌浏览器·浏览器·谷歌·实用工具·办公学习神器
源来是大数据的菜鸟2 天前
基于Multi-Agent开发的SmartCare系统自动化运维管家
python·运维开发
UpYoung!4 天前
无广技术贴!【PDF编辑器】Solid Converter PDF保姆级图文下载安装指南——实用推荐之PDF编辑软件
学习·数学建模·pdf·编辑器·运维开发·个人开发
vortex55 天前
建立本地 APT 仓库教程
linux·运维开发
UpYoung!6 天前
【Typora——MD编辑器】Typora最新 V1.12.1版:轻量级 Markdown 编辑器详细图文下载安装使用教程
学习·数学建模·编辑器·运维开发·个人开发
xgysimida7 天前
一文搞懂supervisord是什么?
运维·运维开发
-dcr12 天前
24.grep 使用手册
linux·运维开发·grep
vortex513 天前
fd 工具指南:find 的现代替代品
linux·运维开发·命令行工具