vmware下linux 如何添加硬盘

1.在虚拟机的设置中增加一块硬盘。
  setting -> add disk -> create a new virtual disk -> SCSI
  设定大小,这里给3G;更改名称,我这个硬盘用来安装Oracle ,名字为oradata.vmdk
2.格式化硬盘。 
[root@libydwei ~]# fdisk -l /dev/sdb

Disk /dev/sdb: 2147 MB, 2147483648 bytes
255 heads, 63 sectors/track, 261 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes Disk /dev/sdb doesn't contain a valid partition table

  对硬盘进行格式化,这里不用指定分区类型,默认的linux就可以。

[root@libydwei ~]# fdisk /dev/sdb

Command (m for help): p

Disk /dev/sdb: 2147 MB, 2147483648 bytes
255 heads, 63 sectors/track, 261 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes Device Boot Start End Blocks Id System Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): q
Partition number (1-4): 1
First cylinder (1-261, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-261, default 261):
Using default value 261 Command (m for help): p Disk /dev/sdb: 2147 MB, 2147483648 bytes
255 heads, 63 sectors/track, 261 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes Device Boot Start End Blocks Id System
/dev/sdb1 1 261 2096451 83 Linux Command (m for help):

  3.创建文件系统

[root@libydwei ~]# mkfs.ext3 /dev/sdb1

  4.挂载分区。这里我们要将oracle 挂载在 /u01目录下。

[root@libydwei ~]# mount -t ext3 /dev/sdb1 /u01
[root@libydwei ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda2 3.9G 2.4G 1.3G 66% /
/dev/sda1 46M 11M 33M 24% /boot
none 252M 0 252M 0% /dev/shm
/dev/sda3 7.0G 49M 6.6G 1% /home
/dev/sdb1 2.0G 36M 1.9G 2% /u01
[root@libydwei ~]#

  在文件fstab末尾添加     /dev/sdb1 /u01 ext3 defaults 0 0

# This file is edited by fstab-sync - see 'man fstab-sync' for details
LABEL=/ / ext3 defaults 1 1
LABEL=/boot /boot ext3 defaults 1 2
none /dev/pts devpts gid=5,mode=620 0 0
none /dev/shm tmpfs defaults 0 0
LABEL=/home /home ext3 defaults 1 2
none /proc proc defaults 0 0
none /sys sysfs defaults 0 0
LABEL=SWAP-sda5 swap swap defaults 0 0
# Beginning of the block added by the VMware software
.host:/ /mnt/hgfs vmhgfs defaults,ttl=5 0 0
# End of the block added by the VMware software
/dev/hdc /media/cdrecorder auto pamconsole,fscontext=system_u:object_r:removable_t,exec,noauto,managed 0 0
/dev/fd0 /media/floppy auto pamconsole,fscontext=system_u:object_r:removable_t,exec,noauto,managed 0 0 /dev/sdb1 /u01 ext3 defaults 0 0

  

上一篇:用WordPress建立专业网站教程 (一步步建站, 一步也不少)


下一篇:Linux遗忘root密码的其中两种解决方法