linux添加新硬盘命令 linux添加新硬盘( 二 )


6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
可以看到这台机器加载了三个磁盘sda、sdb、sdc
其中sda是初始磁盘,sdb已经初始化且经过使用,sdc是刚刚加载的,未格式化的新磁盘
四、创建新硬盘分区
[root@localhost ~]# fdisk /dev/sdc #进入磁盘
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel with disk identifier 0x45a3cadb.
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
Command action
atoggle a bootable flag#设定可启动标记
bedit bsd disklabel
ctoggle the dos compatibility flag
ddelete a partition#删除一个分区
llist known partition types#各分区类型所对应的ID
mprint this menu#菜单
nadd a new partition#添加一个分区
ocreate a new empty DOS partition table
pprint the partition table#显示该磁盘下的当前分区信息
qquit without saving changes #不保存退出
screate a new empty Sun disklabel
tchange a partition's system id
uchange display/entry units
vverify the partition table
wwrite table to disk and exit #保存退出
xextra functionality (experts only)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
知道命令之后就可以进行分区了
Command (m for help): p //打印分区信息,可以看到当前并没有分区
Disk /dev/sdc: 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: 0x45a3cadb
Device BootStartEndBlocksIdSystem
Command (m for help): n //创建一个新的分区
Command action
eextended//输入e为创建扩展分区
pprimary partition (1-4) //输入p为创建逻辑分区
p
Partition number (1-4): 1//划分逻辑分区
First cylinder (1-2610, default 1): //我这里直接回车,是不想把该磁盘分成多个分区,把整个磁盘作为1个分区
Using default value 1
Last cylinder, +cylinders or +size{K,M,G} (1-2610, default 2610):
Using default value 2610
Command (m for help): p //再次查看可以看到该磁盘已经有1个分区了
Disk /dev/sdc: 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: 0x45a3cadb
Device BootStartEndBlocksIdSystem
/dev/sdc11261020964793+83Linux
Command (m for help): w //保存分区
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30

推荐阅读