替VMware Linux添加虚拟硬盘

为VMware Linux添加虚拟硬盘

场景:VMware安装linux的时候默认分配的空间是4GB,可能会不够,这个时候可以通过增加一块虚拟硬盘,将/usr或其他内容拷贝过去解决这个问题:

创建虚拟硬盘
1、关闭VM中正在运行的虚拟系统;
2、在虚拟系统名称上点右键->Virtual Machine Settings;
3、在Hardware页点“Add”->Add a hard disk->Create a new virtual disk->SCSI(recommended)->分配空间大小->OK;
4、可以看见Hardware中出现了一块新的硬盘Hard Disk 2。

对虚拟硬盘进行分区和格式化
——————————————-
## 查看目前系统上有几块硬盘
[root@zhou-desktop ~]# fdisk -l

Disk /dev/hda: 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/hda1?? *???????? 132??????? 1305???? 9430155?? 83? Linux
/dev/hda2?????????????? 1???????? 131???? 1052226?? 82? Linux swap / Solaris

Partition table entries are not in disk order

Disk /dev/hdb: 10.7 GB, 10737418240 bytes
15 heads, 63 sectors/track, 22192 cylinders
Units = cylinders of 945 * 512 = 483840 bytes

Disk /dev/hdb doesn’t contain a valid partition table
——————————————-
对/dev/hdb分区进行分区
[root@zhou-desktop ~]# fdisk /dev/hdb
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 22192.
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): 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): p?? ??? ?## 打印出目前该硬盘下的分区列表

Disk /dev/hdb: 10.7 GB, 10737418240 bytes
15 heads, 63 sectors/track, 22192 cylinders
Units = cylinders of 945 * 512 = 483840 bytes

?? Device Boot????? Start???????? End????? Blocks?? Id? System

Command (m for help): n?? ??? ?## 增加一个分区
Command action
?? e?? extended
?? p?? primary partition (1-4)
p?? ??? ??? ??? ??? ??? ??? ?## 通常选择主分区,所以这里选p
Partition number (1-4): 1?? ?## 第一个分区,选1;第二个分区,选2,依次类推
First cylinder (1-22192, default 1): ## 默认值,回车
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-22192, default 22192):
## 如果要分区10G,这里可以直接输入:+10240M,因为这里要全部使用硬盘空间,则用默认
Using default value 22192

Command (m for help): p

Disk /dev/hdb: 10.7 GB, 10737418240 bytes
15 heads, 63 sectors/track, 22192 cylinders
Units = cylinders of 945 * 512 = 483840 bytes

?? Device Boot????? Start???????? End????? Blocks?? Id? System
/dev/hdb1?????????????? 1?????? 22192??? 10485688+? 83? Linux

## 第一个分区已经分好了,接下来把这个分区写入硬盘,用w
Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.

## 下面的工作就是对该硬盘进行格式,格式化成ext3
[root@zhou-desktop ~]# mkfs.ext3 /dev/hdb1
mke2fs 1.39 (29-May-2006)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
1310

替VMware Linux添加虚拟硬盘

相关文章:

你感兴趣的文章:

标签云: