目的是:将虚拟机的容量从20G扩大到25G
编辑虚拟机设置 :

硬盘 - 扩展磁盘容量 :

填入扩容后大小:

以下在ubuntu/linux里操作:
查看当前分区情况:
biren@ubuntu:~$ df -Th
Filesystem Type Size Used Avail Use% Mounted on
udev devtmpfs 955M 0 955M 0% /dev
tmpfs tmpfs 196M 1.8M 195M 1% /run
/dev/sda1 ext4 20G 19G 498M 98% / 只剩下542M空间,ext4格式
tmpfs tmpfs 980M 0 980M 0% /dev/shm
tmpfs tmpfs 5.0M 4.0K 5.0M 1% /run/lock
tmpfs tmpfs 980M 0 980M 0% /sys/fs/cgroup
/dev/loop0 squashfs 768K 768K 0 100% /snap/gnome-characters/741
......
biren@ubuntu:~/crossbuild$ sudo fdisk -l
Disk /dev/sda: 25 GiB, 26843545600 bytes, 52428800 sectors 共25G空间
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: dos
Disk identifier: 0x305e1b1e
Device Boot Start End Sectors Size Id Type
/dev/sda1 * 2048 41940991 41938944 20G 83 Linux 第一块磁盘的第一分区
其它略...
可以看到/dev/sda共25G,实际使用的还是20G(/dev/sda1)
新增分区:
命令: sudo fdisk /dev/sda
biren@ubuntu:~/crossbuild$ sudo fdisk /dev/sda
[sudo] password for biren:
Welcome to fdisk (util-linux 2.31.1).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.
Command (m for help): m 查看帮助
Help:
DOS (MBR)
a toggle a bootable flag 设置启动标记
b edit nested BSD disklabel
c toggle the dos compatibility flag
Generic
d delete a partition 删除分区
F list free unpartitioned space
l list known partition types 列出分区类型,如 83/8e
n add a new partition 增加分区
p print the partition table
t change a partition type 改变分区类型, 83为linux, 8e为lvm, 82为swap交换分区, 6为fat16, 7为nfs
v verify the partition table

2304

被折叠的 条评论
为什么被折叠?



