Vmware Workstation增加硬盘空间

来源:互联网 发布:c string数组添加元素 编辑:程序博客网 时间:2024/05/16 09:52
Vmware Workstation增加硬盘空间
************
先将虚拟机Power Off,在Virtual Machine Setting对话框里点击左下角的“Add”,选择“Hard Disk”,之后选择“Create a new virtual disk”,分配容量。
[root@centos u01]# df -h
文件系统              容量  已用 可用 已用% 挂载点
/dev/sda1             6.8G  6.8G     0 100% /
tmpfs                 506M     0  506M   0% /dev/shm
①fdisk -l查看是否识别了新硬盘,如果添加的是IDE硬盘,就应该看到hdb,如果是SCSI硬盘,看到的就应该是sdb
[root@centos u01]# fdisk -l

Disk /dev/sda: 8589 MB, 8589934592 bytes
255 heads, 63 sectors/track, 1044 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1         913     7333641   83  Linux
/dev/sda2             914        1044     1052257+  82  Linux swap / Solaris

Disk /dev/sdb: 4294 MB, 4294967296 bytes
255 heads, 63 sectors/track, 522 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Disk /dev/sdb doesn't contain a valid partition table
②使用fdisk /dev/sdc,在出现的选项中选择“w”,即将分区表写入硬盘并退出
[root@centos u01]# 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.

Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.
③fdisk -l查看
[root@centos u01]# fdisk -l

Disk /dev/sda: 8589 MB, 8589934592 bytes
255 heads, 63 sectors/track, 1044 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1         913     7333641   83  Linux
/dev/sda2             914        1044     1052257+  82  Linux swap / Solaris

Disk /dev/sdb: 4294 MB, 4294967296 bytes
255 heads, 63 sectors/track, 522 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
[root@centos u01]# df -h
文件系统              容量  已用 可用 已用% 挂载点
/dev/sda1             6.8G  6.8G     0 100% /
tmpfs                 506M     0  506M   0% /dev/shm
④用mkfs命令将其格式化,mkfs /dev/sdc
[root@centos u01]# mkfs /dev/sdb
mke2fs 1.39 (29-May-2006)
/dev/sdb is entire device, not just one partition!
Proceed anyway? (y,n) y
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
524288 inodes, 1048576 blocks
52428 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=1073741824
32 block groups
3
⑤用mount命令将其挂载,mount -t ext2 /dev/sdb /media
[root@centos u01]# mount -t ext2 /dev/sdb /media
[root@centos u01]# df -h
文件系统              容量  已用 可用 已用% 挂载点
/dev/sda1             6.8G  6.8G     0 100% /
tmpfs                 506M     0  506M   0% /dev/shm
/dev/sdb              4.0G  8.0M  3.8G   1% /media
0 0