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 /
相关推荐
阿朝笔记11 小时前
PC / 外设资产 TCO 测算模型:租赁模式和直接采购怎么量化对比
运维开发·it资产管理·tco测算·硬件全生命周期·itam
Black_Rock_br19 小时前
本地AI工具更新,#DSH Desktop桌面端# 正式发布迭代
人工智能·python·开源·运维开发·开源软件
小谈不敲代码19 小时前
【10-kubernetes的控制器】
kubernetes·运维开发
云计算磊哥@2 天前
运维开发宝典061-CICD_版本控制器git
运维·git·运维开发
终末圆3 天前
GitHub Actions 实现 CI/CD
运维·ci/cd·github·运维开发·devops
goyeer4 天前
Liunx日志管理与journalctl
java·linux·运维·服务器·运维开发·信息化·信息化企业管理
星核0penstarry5 天前
Copilot 用 GLM:自备密钥和官方内置,到底差在哪?
copilot·运维开发·ai编程·api聚合平台
这个DBA有点耶12 天前
数据库一体机架构演进:从硬件堆叠到软硬深度耦合
服务器·网络·数据库·硬件架构·运维开发·database·数据库架构
江南风月14 天前
如何使用WGCLOUD实现智能运维
运维·zabbix·运维开发·prometheus
xiaoxiangsiyan14 天前
HCIA 网络技术基础核心模块详解
运维·网络·网络协议·tcp/ip·运维开发·网络基础