Chinaunix首页 | 论坛 | 博客
  • 博客访问: 92955
  • 博文数量: 32
  • 博客积分: 2144
  • 博客等级: 大尉
  • 技术积分: 370
  • 用 户 组: 普通用户
  • 注册时间: 2008-10-25 09:28
文章分类

全部博文(32)

文章存档

2011年(6)

2010年(2)

2009年(10)

2008年(14)

我的朋友

分类: LINUX

2008-10-26 09:24:01

    N天以前在VM下安装了fedora9.0,刚学习fedora,用了个6G左右的虚拟的硬盘安装fedora,之后安装了vsftpd,samba,mysql,and so on ...结果硬盘空间不够用了,别外挂载了一个硬盘.(我还是喜欢FAQ形式的记录)
  1.怎么样在VM中增加一个硬盘?
      点击VM-->settings...(ctrl+d),出来Virtual Machine Settings对话框.找到Hardware标签,点击Hard Disk (IDE),再点Add按钮.出来Add Hardware Wizard对话框,在这你就可创建一个新的硬盘了.
    2.怎么分区格式化?
         Linux对硬件的管理是基于文件的,刚刚增加的一个硬盘其实在/dev/目录下,设备名叫sdb,我们可以用ls -lh 看一下/dev/sdb是一个块文件.

[root@localhost ~]# ls -hl /dev/sdb
brw-r----- 1 root disk 8, 16 10-26 09:28 /dev/sdb
 
下面对刚增加的硬盘进行分区.
 
[root@localhost ~]# fdisk /dev/sdb 
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel with disk identifier 0x396d026c.
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): n                   #n(new)新建一个分区
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): w                   #w(write)最后别忘了把我们的分区写入到硬盘
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.                            #ok!,分区完了~
   以下是格式化:
[root@localhost ~]# mkfs.ext2 /dev/sdb1   #mkfs.ext2=mkfs -t ext2 
mke2fs 1.40.8 (13-Mar-2008)
Warning: 256-byte inodes not usable on older systems
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
65280 inodes, 261048 blocks
13052 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=268435456
8 block groups
32768 blocks per group, 32768 fragments per group
8160 inodes per group
Superblock backups stored on blocks:
        32768, 98304, 163840, 229376
Writing inode tables: done                           
Writing superblocks and filesystem accounting information: done
This filesystem will be automatically checked every 26 mounts or
180 days, whichever comes first.  Use tune2fs -c or -i to override.
 
 
    3.怎么挂载分区?
      分区,格式化之后可以挂载硬盘了.
[root@localhost ~]# mount /dev/sdb1 /mnt/sdb
     
    4.怎么开机自动挂载文件硬盘?
       其实/etc/fstab是文件系统的配制文件我们改下里面的内容就可以实现自动挂载.

[root@localhost ~]# vi /etc/fstab
/dev/VolGroup00/LogVol00 /                       ext3    defaults        1 1
UUID=3e775749-0e7f-465b-b9d0-7880a4822a9f /boot                   ext3    defaults        1 2
tmpfs                   /dev/shm                tmpfs   defaults        0 0
devpts                  /dev/pts                devpts  gid=5,mode=620  0 0
sysfs                   /sys                    sysfs   defaults        0 0
proc                    /proc                   proc    defaults        0 0
/dev/VolGroup00/LogVol01 swap                    swap    defaults        0 0
/dev/sdb1               /mnt/sdb                ext2     defaults        0 0
#最后一行是我自己加的,第一个字段是硬盘的位置,第二字段是挂载的目录,第三字段是文件系统,后面保持默认.
 
 
 
这样就可以成功的挂载两个或者多个硬盘了!
 
 
阅读(2361) | 评论(0) | 转发(0) |
0

上一篇:理解和认识udev

下一篇:fedora安装vsftpd

给主人留下些什么吧!~~