$ fdisk /dev/sdb
Welcome to fdisk (util-linux 2.32.1).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.
# n 옵션으로 새로운 파티션 추가
Command (m for help): n
Partition number (1-128, default 1):
First sector (34-62914526, default 2048):
# +10K +10G +100M 등 표현 가능
Last sector, +sectors or +size{K,M,G,T,P} (2048-62914526, default 62914526): +10G
Created a new partition 1 of type 'Linux filesystem' and of size 10 GiB.
# p 옵션으로 partition table 확인
Command (m for help): p
Disk /dev/sdb: 30 GiB, 32212254720 bytes, 62914560 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 1048576 bytes
Disklabel type: gpt
Disk identifier: F7C0AE6A-557D-452F-B65C-6104A14B9AE6
Device Start End Sectors Size Type
/dev/sdb1 2048 20973567 20971520 10G Linux filesystem
# n 옵션으로 두 번째 파티션 추가
Command (m for help): n
Partition number (2-128, default 2):
First sector (20973568-62914526, default 20973568):
Last sector, +sectors or +size{K,M,G,T,P} (20973568-62914526, default 62914526): +15G
Created a new partition 2 of type 'Linux filesystem' and of size 15 GiB.
# w 옵션으로 저장
Command (m for help): w
The partition table has been altered.
Calling ioctl() to re-read partition table.
Syncing disks.
# block device의 리스트를 확인.
$ lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
...
sdb 8:16 0 30G 0 disk
├─sdb1 8:17 0 10G 0 part
└─sdb2 8:18 0 15G 0 part
$ fdisk /dev/sdb
Welcome to fdisk (util-linux 2.32.1).
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/sdb: 30 GiB, 32212254720 bytes, 62914560 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 1048576 bytes
Disklabel type: gpt
Disk identifier: F7C0AE6A-557D-452F-B65C-6104A14B9AE6
Device Start End Sectors Size Type
/dev/sdb1 2048 20973567 20971520 10G Linux filesystem
/dev/sdb2 20973568 52430847 31457280 15G Linux filesystem
# d 옵션으로 파티션 삭제
Command (m for help): d
Partition number (1,2, default 2): 2
Partition 2 has been deleted.
Command (m for help): p
Disk /dev/sdb: 30 GiB, 32212254720 bytes, 62914560 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 1048576 bytes
Disklabel type: gpt
Disk identifier: F7C0AE6A-557D-452F-B65C-6104A14B9AE6
Device Start End Sectors Size Type
/dev/sdb1 2048 20973567 20971520 10G Linux filesystem
# w 옵션으로 저장
Command (m for help): w
The partition table has been altered.
Calling ioctl() to re-read partition table.
Syncing disks.
# block device의 리스트를 확인.
$ lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
...
sdb 8:16 0 30G 0 disk
└─sdb1 8:17 0 10G 0 part
5.파일 시스템 구축 및 설정 - Stratis로 스토리지 관리 (0) | 2022.10.23 |
---|---|
5.파일 시스템 구축 및 설정 - 파일 시스템 생성, 마운트, 언마운트 (0) | 2022.10.20 |
1. 필수 툴 이해 및 사용 - grep 정리 (0) | 2022.05.10 |
1. 필수 툴 이해 및 사용 - find 정리 (0) | 2022.05.09 |
1. 필수 툴 이해 및 사용 - 소프트 링크와 하드 링크 (0) | 2022.04.22 |