fdisk
パーティションが最後のパーティションであり、パーティションの先頭が移動していない場合、通常は引き続き使用でき、これを行うことができます。
ただし、これは危険な操作であり、細心の注意を払って行う必要があります。バックアップを作成してください!
ec2-user@ip-10-0-20-15 ~]$ sudo fdisk /dev/nvme0n1
Welcome to fdisk (util-linux 2.30.2).
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/nvme0n1: 24 GiB, 25769803776 bytes, 50331648 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: 70E4A118-98BD-4BF4-8DF9-6926A964902A
Device Start End Sectors Size Type
/dev/nvme0n1p1 4096 16777182 16773087 8G Linux filesystem
/dev/nvme0n1p128 2048 4095 2048 1M BIOS boot
Partition table entries are not in disk order.
Command (m for help): d
Partition number (1,128, default 128): 1
Partition 1 has been deleted.
Command (m for help): n
Partition number (1-127, default 1): 1
First sector (34-50331614, default 4096):
Last sector, +sectors or +size{K,M,G,T,P} (4096-50331614, default 50331614):
Created a new partition 1 of type 'Linux filesystem' and of size 24 GiB.
Partition #1 contains a xfs signature.
Do you want to remove the signature? [Y]es/[N]o: n
Command (m for help): p
Disk /dev/nvme0n1: 24 GiB, 25769803776 bytes, 50331648 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: 70E4A118-98BD-4BF4-8DF9-6926A964902A
Device Start End Sectors Size Type
/dev/nvme0n1p1 4096 50331614 50327519 24G Linux filesystem
/dev/nvme0n1p128 2048 4095 2048 1M BIOS boot
Partition table entries are not in disk order.
Command (m for help): w
The partition table has been altered.
Calling ioctl() to re-read partition table.
Re-reading the partition table failed.: Device or resource busy
The kernel still uses the old table. The new table will be used at the next reboot or after you run partprobe(8) or kpartx(8).
[ec2-user@ip-10-0-20-15 ~]$ sudo partprobe
[ec2-user@ip-10-0-20-15 ~]$ sudo fdisk -l
Disk /dev/nvme0n1: 24 GiB, 25769803776 bytes, 50331648 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: 70E4A118-98BD-4BF4-8DF9-6926A964902A
Device Start End Sectors Size Type
/dev/nvme0n1p1 4096 50331614 50327519 24G Linux filesystem
/dev/nvme0n1p128 2048 4095 2048 1M BIOS boot
Partition table entries are not in disk order.
[ec2-user@ip-10-0-20-15 ~]$ sudo xfs_growfs /
meta-data=/dev/nvme0n1p1 isize=512 agcount=4, agsize=524159 blks
= sectsz=512 attr=2, projid32bit=1
= crc=1 finobt=1 spinodes=0
data = bsize=4096 blocks=2096635, imaxpct=25
= sunit=0 swidth=0 blks
naming =version 2 bsize=4096 ascii-ci=0 ftype=1
log =internal bsize=4096 blocks=2560, version=2
= sectsz=512 sunit=0 blks, lazy-count=1
realtime =none extsz=4096 blocks=0, rtextents=0
data blocks changed from 2096635 to 6290939
```