## 切换到root账号sudo -s
## 查看当前分区信息,可以看到`/dev/vda`磁盘大小为931.1G,但只建立了一个5G大小的`/dev/vda3`分区root@nas:/# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS
sr0 11:0 1 368K 0 rom
vda 254:0 0 931.1G 0 disk
├─vda1 254:1 0 94M 0 part
├─vda2 254:2 0 7.9G 0 part /
└─vda3 254:3 0 5G 0 part
## 下来删除vda3分区,将剩余的磁盘分成一个分区root@nas:/# fdisk /dev/vda
Welcome to fdisk (util-linux 2.38.1).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.
GPT PMBR size mismatch (27262975 != 1952710655) will be corrected by write.
The backup GPT table is not on the end of the device. This problem will be corrected by write.
This disk is currently in use - repartitioning is probably a bad idea.
It's recommended to umount all file systems, and swapoff all swap
partitions on this disk.
Command (m for help): p
Disk /dev/vda: 931.13 GiB, 999787855872 bytes, 1952710656 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
Disklabel type: gpt
Disk identifier: 3B500D66-3E07-4BC5-9D85-F06893DEE158
Device Start End Sectors Size Type
/dev/vda1 2048 194559 192512 94M BIOS boot
/dev/vda2 194560 16777215 16582656 7.9G Linux filesystem
/dev/vda3 16777216 27260927 10483712 5G Linux filesystem
Command (m for help): d ## 使用d命令删除分区
Partition number (1-3, default 3): ## 选择第三个分区
Partition 3 has been deleted.
Command (m for help): n ## 新建分区
Partition number (3-128, default 3): ## 采取默认直接回车键
First sector (16777216-1952710622, default 16777216): ## 采取默认直接回车键
Last sector, +/-sectors or +/-size{K,M,G,T,P} (16777216-1952710622, default 1952708607):
## 将剩余的923.1G全部新建为分区3
Created a new partition 3 of type 'Linux filesystem' and of size 923.1 GiB.
Command (m forhelp): w ## 将修改操作写入磁盘The partition table has been altered.
Syncing disks.
## 查看下最新分区信息,其中/dev/vda3就是我们新建的分区。root@nas:/# fdisk -l
Disk /dev/vda: 931.13 GiB, 999787855872 bytes, 1952710656 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
Disklabel type: gpt
Disk identifier: 3B500D66-3E07-4BC5-9D85-F06893DEE158
Device Start End Sectors Size Type
/dev/vda1 2048194559192512 94M BIOS boot
/dev/vda2 1945601677721516582656 7.9G Linux filesystem
/dev/vda3 1677721619527086071935931392 923.1G Linux filesystem