前言:
linux 版本 CentOS 5.5 64位
虚拟机版本 Vmware Workstation 9.0
1. 在虚拟机上添加一块新硬盘到linux,大小20G (可以自定)
2. 打开终端,使用fdisk格式化分区刚才挂载的新硬盘/dev/sdb,划分出一个100M大小的主分区和一个1G大小的主分区
1). 查看新增加硬盘 fdisk ?l
1
2
3
4
5
6
7
8
9
10
11
12
13
14
|
fdisk -l
Disk /dev/sda: 21.4 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sda1 * 1 33 265041 83 Linux
/dev/sda2 34 1308 10241437+ 83 Linux
/dev/sda3 1309 1945 5116702+ 83 Linux
/dev/sda4 1946 2610 5341612+ 5 Extended
/dev/sda5 1946 2072 1020096 82 Linux swap / Solaris
Disk /dev/sdb: 21.4 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk /dev/sdb doesn't contain a valid partition table
|
2). 分区
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
32
33
34
35
|
[root@localhost ~]# fdisk /dev/sdb
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel. Changes will remain in memory only,
until you decide to write them. After that, of course, the previous
content won't be recoverable.
The number of cylinders for this disk is set to 2610.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
(e.g., DOS FDISK, OS/2 FDISK)
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-2610, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-2610, default 2610): +100M
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 2
First cylinder (14-2610, default 14):
Using default value 14
Last cylinder or +size or +sizeM or +sizeK (14-2610, default 2610): +1G
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
[root@localhost ~]#
|
3). 重读下分区表
1
2
|
[root@localhost ~]# partprobe /dev/sdb
[root@localhost ~]#
|
4). 格式化为ext3文件系统
1
2
|
[root@localhost ~]# mke2fs -j /dev/sdb1
[root@localhost ~]# mke2fs -j /dev/sdb2
|
5). 将刚格式化好的分区/dev/sdb1挂载到/mnt/boot /dev/sdb2挂载到/mnt/sysroot
1
2
3
4
|
[root@localhost ~]# mkdir -p /mnt/boot
[root@localhost ~]# mkdir -p /mnt/sysroot
[root@localhost ~]# mount /dev/sdb1 /mnt/boot/
[root@localhost ~]# mount /dev/sdb2 /mnt/sysroot/
|
6). 查看挂载分区
1
2
3
4
5
6
7
8
9
10
11
12
13
|
[root@localhost ~]# mount
/dev/sda2 on / type ext3 (rw)
proc on /proc type proc (rw)
sysfs on /sys type sysfs (rw)
devpts on /dev/pts type devpts (rw,gid=5,mode=620)
/dev/sda3 on /data type ext3 (rw)
var cpro_id = "u6885494";
写下你的评论吧 !
推荐阅读
|