Linux 分区命令随查

sudo fdisk -l

sudo fdisk /dev/sdb

 

help command

Command (m for help): m

Command action
a toggle a bootable flag
b edit bsd disklabel
c toggle the dos compatibility flag
d delete a partition
l list known partition types
m print this menu
n add a new partition
o create a new empty DOS partition table
p print the partition table
q quit without saving changes
s create a new empty Sun disklabel
t change a partition‘s system id
u change display/entry units
v verify the partition table
w write table to disk and exit
x extra functionality (experts only)

Command (m for help): p

Disk /dev/sdb: 16.1 GB, 16131293184 bytes
255 heads, 63 sectors/track, 1961 cylinders, total 31506432 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
Disk identifier: 0x00000000

Device Boot Start End Blocks Id System
/dev/sdb1 2 614457 307228 b W95 FAT32
/dev/sdb2 614459 12001823 5693682+ af HFS / HFS+

delete patition

Command (m for help): d
Partition number (1-4): 1

Command (m for help): p

Disk /dev/sdb: 16.1 GB, 16131293184 bytes
255 heads, 63 sectors/track, 1961 cylinders, total 31506432 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
Disk identifier: 0x00000000

Device Boot Start End Blocks Id System
/dev/sdb2 614459 12001823 5693682+ af HFS / HFS+

Command (m for help): d
Selected partition 2

Command (m for help): p

Disk /dev/sdb: 16.1 GB, 16131293184 bytes
255 heads, 63 sectors/track, 1961 cylinders, total 31506432 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
Disk identifier: 0x00000000

Device Boot Start End Blocks Id System

new patitioin

Command (m for help): n
Partition type:
p primary (0 primary, 0 extended, 4 free)
e extended
Select (default p): p
Partition number (1-4, default 1): 1
First sector (2048-31506431, default 2048):
Using default value 2048
Last sector, +sectors or +size{K,M,G} (2048-31506431, default 31506431):
Using default value 31506431

Command (m for help): p

Disk /dev/sdb: 16.1 GB, 16131293184 bytes
255 heads, 63 sectors/track, 1961 cylinders, total 31506432 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
Disk identifier: 0x00000000

Device Boot Start End Blocks Id System
/dev/sdb1 2048 31506431 15752192 83 Linux

change patition type

Command (m for help): t
Partition number (1-4): 1
Hex code (type L to list codes): b
Changed system type of partition 1 to b (W95 FAT32)

Command (m for help): p

Disk /dev/sdb: 16.1 GB, 16131293184 bytes
48 heads, 6 sectors/track, 109397 cylinders, total 31506432 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
Disk identifier: 0x00000000

Device Boot Start End Blocks Id System
/dev/sdb1 2048 2000000 998976+ b W95 FAT32
/dev/sdb2 2000001 30000000 14000000 83 Linux
/dev/sdb3 30000001 31506431 753215+ 83 Linux

Command (m for help): t
Partition number (1-4): 2
Hex code (type L to list codes): 87
Changed system type of partition 2 to 87 (NTFS volume set)

Command (m for help): p

Disk /dev/sdb: 16.1 GB, 16131293184 bytes
48 heads, 6 sectors/track, 109397 cylinders, total 31506432 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
Disk identifier: 0x00000000

Device Boot Start End Blocks Id System
/dev/sdb1 2048 2000000 998976+ b W95 FAT32
/dev/sdb2 2000001 30000000 14000000 87 NTFS volume set
/dev/sdb3 30000001 31506431 753215+ 83 Linux

sudo mkfs -t ntfs /dev/sdb2

Cluster size has been automatically set to 4096 bytes.
Initializing device with zeroes: 3% ....

 

郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。