1。增加前先關閉VM,然后編輯VM屬性,增加一個vritual disk(scsi),其實是增加一個虛擬磁盤文件。
hard disk2就是我新增加的
2。查看目前的磁盤結構
[root@mail ~]# fdisk -l
Disk /dev/sda: 10.7 GB, 10737418240 bytes
255 heads, 63 sectors/track, 1305 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sda1 * 1 13 104391 83 Linux
/dev/sda2 14 905 7164990 83 Linux
/dev/sda3 906 1032 1020127+ 83 Linux
/dev/sda4 1033 1305 2192872+ 5 Extended
/dev/sda5 1033 1159 1020096 82 Linux swap / Solaris
/dev/sda6 1160 1305 1172713+ 83 Linux
Disk /dev/sdb: 1073 MB, 1073741824 bytes
255 heads, 63 sectors/track, 130 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk /dev/sdb doesn't contain a valid partition table
//說明磁盤/dev/sdb還沒有被系統識別
3。分區
[root@mail ~]# fdisk /dev/sbd
Command (m for help): n //輸入m獲得幫助信息,n創建分區
Command action
e extended
p primary partition (1-4)
p //創建主分區
Partition number (1-4): 1 //指定分區的起始柱面
First cylinder (1-130, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-130, default 130): //設置分區容量,直接回車表示全部
Using default value 130
Command (m for help): t //改變一個分區的系統ID
Selected partition 1
Hex code (type L to list codes): L //查看文件類型對應的Hex
85 Linux extended //linux ext3的hex是85
Hex code (type L to list codes): 85
You cannot change a partition into an extended one or vice versa
Delete it first.
Command (m for help): p //列出當前硬盤的分區
Disk /dev/sdb: 1073 MB, 1073741824 bytes
255 heads, 63 sectors/track, 130 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sdb1 1 130 1044193+ 83 Linux
Command (m for help): w //保存
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
4。查看現在的分區
[root@mail ~]# fdisk -l
Disk /dev/sda: 10.7 GB, 10737418240 bytes
255 heads, 63 sectors/track, 1305 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sda1 * 1 13 104391 83 Linux
/dev/sda2 14 905 7164990 83 Linux
/dev/sda3 906 1032 1020127+ 83 Linux
/dev/sda4 1033 1305 2192872+ 5 Extended
/dev/sda5 1033 1159 1020096 82 Linux swap / Solaris
/dev/sda6 1160 1305 1172713+ 83 Linux
Disk /dev/sdb: 1073 MB, 1073741824 bytes
255 heads, 63 sectors/track, 130 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sdb1 1 130 1044193+ 83 Linux
5。格式化分區
[root@mail ~]# mkfs.ext3 /dev/sdb1 //格式化成ext3格式
6。掛載分區
[root@mail ~]# mount /dev/sdb1 /tmp
[root@mail ~]# df -h /tmp
Filesystem Size Used Avail Use% Mounted on
/dev/sdb1 1004M 1.3M 952M 1% /tmp
7。自動掛載
修改/etc/fstab
增加一行
/dev/sdb1 /sdb1 ext3 defaults 0 0
重起
本文出自 “allen的學習筆記” 博客,請務必保留此出處http://allenyu.blog.51cto.com/193668/156256