快速业务通道

linux虚拟机添加硬盘

作者 佚名技术 来源 Linux系统 浏览 发布时间 2012-07-04
Id System

/dev/hda1 * 1 13 104391 83 Linux

/dev/hda2 14 89 610470 82 Linux swap / Solaris

/dev/hda3 90 2610 20249932 83 Linux

Disk /dev/hdb: 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/hdb1 1 1305 10482381 83 Linux

显示/dev/hdb上有一个hdb1分区,为linux格式.

分区后,需要对这个分区进行格式化.

[root@g11-64-1 ~]# 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)

1310720 inodes, 2620595 blocks

131029 blocks (5.00%) reserved for the super user

First data block=0

Maximum filesystem blocks=2684354560

80 block groups

32768 blocks per group, 32768 fragments per group

16384 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 39 mounts or

180 days, whichever comes first. Use tune2fs -c or -i to override.

将新建分区挂在到/mnt/hdb1上.

[root@g11-64-1 ~]# mkdir /mnt/hdb1

[root@g11-64-1 ~]# mount /dev/hdb1 /mnt/hdb1

[root@g11-64-1 ~]# df -h

Filesystem Size Used Avail Use% Mounted on

/dev/hda3 19G 8.2G 9.7G 46% /

/dev/hda1 99M 16M 79M 17% /boot

tmpfs 250M 0 250M 0% /dev/shm

/dev/hdb1 9.9G 151M 9.2G 2% /mnt/hdb1

[root@g11-64-1 ~]#

hdb1已挂载到/mnt/hdb1上,剩余空间为9.2G.

在此分区上创建文件.

[root@g11-64-1 ~]# cd /mnt/hdb1

[root@g11-64-1 hdb1]# ls > a

[root@g11-64-1 hdb1]# ls -hl

total 20K

-rw-r--r-- 1 root root 13 Nov 3 08:45 a

drwx------ 2 root root 16K Nov 3 08:44 lost found

[root@g11-64-1 hdb1]#

卸载hdb1分区.

[root@g11-64-1 hdb1]# cd

[root@g11-64-1 ~]# umount /mnt/hdb1

[root@g11-64-1 ~]# df -h

Filesystem Size Used Avail Use% Mounted on

/dev/hda3 19G 8.2G 9.7G 46% /

/dev/hda1 99M 16M 79M 17% /boot

tmpfs 250M 0 250M 0% /dev/shm

[root@g11-64-1 ~]#

三.设置新硬盘开机自动挂载

在/etc/fstab中添加新硬盘的挂载信息.添加下面一行:

/dev/hdb1 /mnt/hdb1 ext3 defaults 1 2

这样,每次开机后,系统会自动将/dev/hdb1挂载到/mnt/hdb1上.

凌众科技专业提供服务器租用、服务器托管、企业邮局、虚拟主机等服务,公司网站:http://www.lingzhong.cn 为了给广大客户了解更多的技术信息,本技术文章收集来源于网络,凌众科技尊重文章作者的版权,如果有涉及你的版权有必要删除你的文章,请和我们联系。以上信息与文章正文是不可分割的一部分,如果您要转载本文章,请保留以上信息,谢谢!

分享到: 更多

Copyright ©1999-2011 厦门凌众科技有限公司 厦门优通互联科技开发有限公司 All rights reserved

地址(ADD):厦门软件园二期望海路63号701E(东南融通旁) 邮编(ZIP):361008

电话:0592-5908028 传真:0592-5908039 咨询信箱:web@lingzhong.cn 咨询OICQ:173723134

《中华人民共和国增值电信业务经营许可证》闽B2-20100024  ICP备案:闽ICP备05037997号