20151117 Linux下磁碟管理(centos 6.5)1.新增硬碟 2.硬碟分割槽 3.格式化硬碟 4.掛載硬碟 5.設定開機自動掛載】
阿新 • • 發佈:2019-01-22
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel with disk identifier 0xa927e91e.
Changes will remain in memory only, until you decide to write them.
After that, of course, the previous content won't be recoverable.
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w( rite)
WARNING: DOS-compatible mode is deprecated. It's strongly recommended to
switch off the mode (command 'c') and change display units to
sectors (command 'u').
Command (m for help): m裝置名 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)
一個磁碟的主分割槽最多分4個,e+p<=4
Command (m for help): p
檢視分割槽
Disk /dev/sdb: 10.7 GB, 10737418240 bytes
255 heads, 63 sectors/track, 1305 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: 0x7db1aebb
Device Boot Start End Blocks Id System
Command (m for help): n
建立分割槽
e extended
p primary partition (1-4)
p 建立主分割槽
Partition number (1-4): 1 從第一塊開始
First cylinder (1-1305, default 1): 1 (從一塊柱面可以,也是大小從1開始)
Last cylinder, +cylinders or +size{K,M,G} (1-1305, default 1305): +1G
(增加1G)
Command (m for help): n
Command action
e extended
p primary partition (1-4)
e 建立擴充套件分割槽
Partition number (1-4): 2 這裡要從第2塊開始,因為第一塊已經有人用了
First cylinder (133-1305, default 133):
Using default value 133
Last cylinder, +cylinders or +size{K,M,G} (133-1305, default 1305): +5G 分到5G
Command (m for help): p 檢視分割槽
Disk /dev/sdb: 10.7 GB, 10737418240 bytes
255 heads, 63 sectors/track, 1305 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: 0xa927e91e
Device Boot Start End Blocks Id System
/dev/sdb1 1 132 1060258+ 83 Linux 主分割槽
/dev/sdb2 133 786 5253255 5 Extended 擴充套件分割槽
Command (m for help): n
Command action
l logical (5 or over)
p primary partition (1-4)
l
First cylinder (133-786, default 133):
Using default value 133
Last cylinder, +cylinders or +size{K,M,G} (133-786, default 786): +1G
Command (m for help): p
Disk /dev/sdb: 10.7 GB, 10737418240 bytes
255 heads, 63 sectors/track, 1305 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: 0xa927e91e
Device Boot Start End Blocks Id System
/dev/sdb1 1 132 1060258+ 83 Linux
/dev/sdb2 133 786 5253255 5 Extended 擴充套件分割槽包含邏輯分割槽
(擴充套件分割槽不用來存放資料,而是用來存放邏輯分割槽)
/dev/sdb5 133 264 1060258+ 83 Linux 邏輯分割槽(邏輯分割槽從sdb5開始)
Command (m for help): n
Command action
l logical (5 or over)
p primary partition (1-4)
p
Partition number (1-4): 3 這裡從第三塊開始,因為前面已經使用了2塊。
First cylinder (787-1305, default 787):
Using default value 787
Last cylinder, +cylinders or +size{K,M,G} (787-1305, default 1305): +1G
Command (m for help): p
Disk /dev/sdb: 10.7 GB, 10737418240 bytes
255 heads, 63 sectors/track, 1305 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: 0xa927e91e
Device Boot Start End Blocks Id System
/dev/sdb1 1 132 1060258+ 83 Linux 主分割槽
/dev/sdb2 133 786 5253255 5 Extended 擴充套件分割槽
/dev/sdb3 787 918 1060290 83 Linux 主分割槽
/dev/sdb5 133 264 1060258+ 83 Linux 邏輯分割槽 e+P<=4
擴充套件分割槽+主分割槽<=4
Command (m for help): w 最後儲存
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
Disk /dev/sda: 21.5 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 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: 0x000afeab
Device Boot Start End Blocks Id System
/dev/sda1 * 1 39 307200 83 Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2 39 2481 19614720 83 Linux
/dev/sda3 2481 2611 1048576 82 Linux swap / Sola ris
Disk /dev/sdb: 10.7 GB, 10737418240 bytes
255 heads, 63 sectors/track, 1305 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: 0xa927e91e
Device Boot Start End Blocks Id System
/dev/sdb1 1 132 1060258+ 83 Linux
/dev/sdb2 133 786 5253255 5 Extended
/dev/sdb3 787 918 1060290 83 Linux
/dev/sdb5 133 264 1060258+ 83 Linux