Vmware Workstation 用户空间扩展

转自:http://hi.baidu.com/eastream/blog

 

      Vmware Workstation 用户空间扩展


 

由于开发内容的增多增大, Vmware Workstation 安装时设置的空间已不能满足现状的开发。从开发系统的角度来考虑,最为有效的设计办法是:把用户开发的空间 mount 到一个独立的大小足够大的独立空间。

STEP 1 :在 Vmware Workstation 添加一个新的 virtual disk

这里 Disk capacity 大小不能超过 4G 。这是由于 FAT32 文件系统最大文件大小为 4G 所限制,( 2^32 = 4G )。这里,我设置 3G SCSI 。

STEP 2 :检查磁盘存在

       STEP 1 后,用命令: fdisk –l 。 并没有发现新的磁盘: Disk /dev/sdb 。没办法,重启 LINUX 系统。后发现了新的磁盘:

Disk /dev/sdb: 3221 MB, 3221225472 bytes

255 heads, 63 sectors/track, 391 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

Disk identifier: 0x00000000

Disk /dev/sdb doesn't contain a valid partition table

最后这个提示要求我们对 sdb 进行格式化

STEP 3 :添加磁盘分区

       fdisk /dev/sdb

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): n

Command action

   e   extended

   p   primary partition (1-4)

p

Partition number (1-4): 1

First cylinder (1-391, default 1): 1

Last cylinder or +size or +sizeM or +sizeK (1-391, default 391): 391

Command (m for help): p

Disk /dev/sdb: 3221 MB, 3221225472 bytes

255 heads, 63 sectors/track, 391 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

Disk identifier: 0x42531784

   Device Boot      Start         End      Blocks   Id System

/dev/sdb1               1         391     3140676 83 Linux

Command (m for help): w

The partition table has been altered!

Calling ioctl() to re-read partition table.

Syncing disks.

这样就将这个磁盘所有空间创建为一个分区。

STEP 4 :格式化磁盘分区

       本 LINUX 系统使用的是 EXT3 文件系统。于是乎,将 EXT3 格式化 SDB1

$ mkfs.ext3 /dev/sdb1

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)
196608 inodes, 785169 blocks
39258 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=805306368
24 block groups
32768 blocks per group, 32768 fragments per group
8192 inodes per group
Superblock backups stored on blocks:
    32768, 98304, 163840, 229376, 294912

Writing inode tables: done                           
Creating journal (16384 blocks): done
Writing superblocks and filesystem accounting information: done

This filesystem will be automatically checked every 29 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.

STEP 5 :挂载

$ sudo mount /dev/sdb1 /home/zhoudy/newspace

这样就可以挂载了。但是,还不行,用户无法操作。

设置启动项:

vi /etc/fstab

A 方案:

/dev/sdb1      /home/zhoudy/newspace   ext3    defaults        0       0

$ mount –a

$ mount

gvfs-fuse-daemon on /home/zhoudy/.gvfs type fuse.gvfs-fuse-daemon (rw,nosuid,nodev,user=zhoudy)

/dev/sdb1 on /home/zhoudy/newspace type ext3 (rw)

B 方案 :

/dev/sdb1       /home/zhoudy/newspace   ext3    ( noauto, ) user,exec      0      0

这种设置,用户可以自行 mount 和 umont.

       但是,如果是 ROOT MOUNT 的,那么用户无法 UMOUNT 。

$ mount –a

$ mount

gvfs-fuse-daemon on /home/zhoudy/.gvfs type fuse.gvfs-fuse-daemon (rw,nosuid,nodev,user=zhoudy)

/dev/sdb1 on /home/zhoudy/newspace type ext3 (rw,nosuid,nodev,user)

       如果是 USER MOUNT 的,那么,可以 UMOUNT 。

$ mount –a

$ mount

gvfs-fuse-daemon on /home/zhoudy/.gvfs type fuse.gvfs-fuse-daemon (rw,nosuid,nodev,user=zhoudy)

       /dev/sdb1 on /home/zhoudy/newspace type ext3 (rw,nosuid,nodev,user=zhoudy)

如果设置了 noauto ,只能手动 mount ,开机不会 AOTU MOUNT 。可以修改用户 bash 实现:

设置如何自动在系统启动的时候 MOUNT , UMOUNT 这个分区。进入用户目录,

$ vi ~/.bash_profile        and ADD:

mount /home/zhoudy/newspace

$ vi ~/.bash_logout       and ADD:

umount /home/zhoudy/newspace

Or: /dev/sdb1      /home/zhoudy/newspace   ext3    defaults        0       0

设置如何自动在系统启动的时候 MOUNT , UMOUNT 这个分区。进入用户目录,

$ vi ~/.bash_profile        and ADD:

mount /home/zhoudy/newspace

$ vi ~/.bash_logout       and ADD:

umount /home/zhoudy/newspace

STEP6 :检查

drwxr-xr-x 3 zhoudy zhoudy 4096 2009-08-02 18:22 newspace

ROOT 或用户, touch file. 可以写入。

OK

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值