现在我们用虚拟系统进行演示!

一、给系统添加磁盘

首先确定你要添加磁盘的熊并关闭系统,给虚拟系统添加一块磁盘。

wKiom1NmXTHh9xU1AAJn4UCaQ2w515.jpg

在上面这个界面中选择Edit virtual machine setting选项,进入到下图;


wKioL1NmXQiQ85ExAAKKIDG_iGw571.jpg

在上图中选Add选项,然后选择harddis,一直选择next直到finish;添加成功后得到下图;


wKiom1NmXTPSkR3rAADet3oXqXI748.jpg

和第一个图相比,可以看出多了一个Hard Disk2,这时添加磁盘已经成功了,现在对磁盘进行分区;


二、磁盘分区需要以下几个步骤:

1.创建分区

[root@localhost ~]# fdisk -l  查看磁盘的分区情况

用fdisk命令对刚添加的磁盘进行分区;安装系统的时候是第一块磁盘,为/dev/sda,接下来添加的是/dev/sdb、第三块/dev/sdc依次类推;

[root@localhost ~]# fdisk  /dev/sdb      #用fdisk命令进行分区
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)
p  #主分区
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.

2.格式化
[root@localhost ~]# mkfs.ext4   /dev/sdb1  #格式化sdb1这个分区
mke2fs 1.41.12 (17-May-2010)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
655776 inodes, 2622603 blocks
131130 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=2688548864
81 block groups
32768 blocks per group, 32768 fragments per group
8096 inodes per group
Superblock backups stored on blocks: 
	32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632

Writing inode tables: done                            
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done

This filesystem will be automatically checked every 32 mounts or
180 days, whichever comes first.  Use tune2fs -c or -i to override.
[root@localhost ~]#

3.新建挂载目录

mkdir  /media            ######新建挂载目录


4.挂载使用mount /dev/sdb1  /media  ######挂载使用新的分区

到此,一块新的磁盘已经可以使用了!


************************

参考书籍:《鸟哥私房菜》

指导老师:冯德勇老师