Linux使用fdisk進行磁盤分區

創建分區:
[root@localhost ~]# fdisk -l #查看磁盤的分區情況
[root@localhost ~]# fdisk /dev/sdb #給/dev/sdb分區
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): n
Command action
e extended #擴展分區
p primary partition (1-4) #主分區
Partition number (1-4): 1 #主分區的編號
First cylinder (1-10443, default 1):
Using default value 1
Last cylinder, +cylinders or +size{K,M,G} (1-10443, default 10443): +10G #指定分區的大小
Command (m for help): p

Disk /dev/sdb: 85.9 GB, 85899345920 bytes
255 heads, 63 sectors/track, 10443 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x38913320

Device Boot Start End Blocks Id System
/dev/sdb1 1 1306 10490413+ 83 Linux

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.

格式化分區:
[root@localhost ~]# mkfs.ext4 /dev/sdb1 #格式化sdb1這個分區

掛載使用:
[root@localhost ~]# mount /dev/sdb1 /music

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章