ubuntu 18 VMWare 如何 命令行 扩展磁盘

本文详细介绍了如何在Ubuntu18的VMWare环境中通过命令行进行磁盘扩容。首先,由于下载和编译操作导致硬盘满载,然后在关闭虚拟机后扩展磁盘至500GB。重启后无法进入图形界面,通过Ctrl+Alt+F2切换到控制台,使用fdisk删除原有分区并创建新分区,最后使用resize2fs更新文件系统大小。步骤清晰,操作简便。
摘要由CSDN通过智能技术生成

ubuntu 18 VMWare 如何 命令行 扩展磁盘

ubuntu 18 ,边下载,边编译yocto,导致 硬盘 全满了.
然后 关机之后, 设置 扩展磁盘到500G.
重启虚拟机,进入不了图形界面
在这里插入图片描述

这个时候,需要等一下,然后输入 cltr + alt +f2 进入控制台界面.
然后在命令行执行 重新分区命令.

参考1

VMware虚拟机下ubuntu磁盘扩容(亲测有效)
https://blog.csdn.net/pzslongyutianxia/article/details/119840433

参考2

https://blog.csdn.net/weixin_46222091/article/details/124443257
fdisk扩展分区

root@cmp:/home/cmp/Downloads# fdisk /dev/sda

Welcome to fdisk (util-linux 2.34).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.

Command (m for help): p
Disk /dev/sda: 100 GiB, 107374182400 bytes, 209715200 sectors
Disk model: VMware Virtual S
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: 3EDB8DA1-4B24-4EB9-B3E6-60F47A913588

Device Start End Sectors Size Type
/dev/sda1 2048 4095 2048 1M BIOS boot
/dev/sda2 4096 104855551 104851456 50G Linux filesystem
/dev/sda3 104855552 209715166 104859615 50G Linux filesystem

Command (m for help): d
Partition number (1-3, default 3):

Partition 3 has been deleted.

Command (m for help): p
Disk /dev/sda: 100 GiB, 107374182400 bytes, 209715200 sectors
Disk model: VMware Virtual S
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: 3EDB8DA1-4B24-4EB9-B3E6-60F47A913588

Device Start End Sectors Size Type
/dev/sda1 2048 4095 2048 1M BIOS boot
/dev/sda2 4096 104855551 104851456 50G Linux filesystem

Command (m for help): d
Partition number (1,2, default 2):

Partition 2 has been deleted.

Command (m for help): p
Disk /dev/sda: 100 GiB, 107374182400 bytes, 209715200 sectors
Disk model: VMware Virtual S
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: 3EDB8DA1-4B24-4EB9-B3E6-60F47A913588

Device Start End Sectors Size Type
/dev/sda1 2048 4095 2048 1M BIOS boot

Command (m for help): n
Partition number (2-128, default 2):
First sector (4096-209715166, default 4096):
Last sector, +/-sectors or +/-size{K,M,G,T,P} (4096-209715166, default 209715166):

Created a new partition 2 of type ‘Linux filesystem’ and of size 100 GiB.
Partition #2 contains a ext4 signature.

Do you want to remove the signature? [Y]es/[N]o: Y

The signature will be removed by a write command.

Command (m for help): p
Disk /dev/sda: 100 GiB, 107374182400 bytes, 209715200 sectors
Disk model: VMware Virtual S
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: 3EDB8DA1-4B24-4EB9-B3E6-60F47A913588

Device Start End Sectors Size Type
/dev/sda1 2048 4095 2048 1M BIOS boot
/dev/sda2 4096 209715166 209711071 100G Linux filesystem

Filesystem/RAID signature on partition 2 will be wiped.

Command (m for help): w
The partition table has been altered.
Syncing disks.

resize2fs更新分区

sudo resize2fs /dev/sda1

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值