ubuntu下添加新的磁盘

昨天在VMware里安装了Ubuntu 6.06,硬盘空间是默认的4GB,安装了scratchbox和maemo SDK以后,磁盘基本上快满了。

从Ubuntu的Blog里找到添加磁盘并移动文件系统的方法:

修改虚拟机的设置,添加一个新的scsi硬盘

1. 用fdisk分区

$ sudo fdisk /dev/sdb

2. 建文件系统

$ sudo mkfs /dev/sdb1 -t ext3

3. mount上新的分区

$ sudo mkdir /mnt/newusr
$ sudo mount -t ext3 /dev/sdb1 /mnt/newusr

4. 复制/usr下的文件到新的分区(不能直接用cp命令)

$ cd /usr/
$ sudo find . -depth -print0 | sudo cpio --null --sprse -pvd /mnt/newusr

5. mount新的分区

$ sudo umount /mnt/newusr
$ sudo mv /usr /old_usr
$ /old_usr/bin/sudo mkdir /usr
$ /old_usr/bin/sudo mount /dev/sdb1 /usr

6. 修改/etc/fstab,告诉ubuntu启动时mount新的分区

$ sudo vi /etc/fstab
/dev/sdb1 /usr ext3 defaults 0 1

7. 重启ubuntu,一切正常的话,就可以删除旧的/usr目录了

$ sudo rm -r /old_usr

8. 如果有问题的话,可以试试到recover模式下去恢复,不过我没遇到这种情况。Good luck!

Ref: http://ubuntu.wordpress.com/2006/01/29/move-home-to-its-own-partition/

2 thoughts on “ubuntu下添加新的磁盘

  1. Pingback: Studio2 free

Leave a Reply

Your email address will not be published. Required fields are marked *

*

To create code blocks or other preformatted text, indent by four spaces:

    This will be displayed in a monospaced font. The first four 
    spaces will be stripped off, but all other whitespace
    will be preserved.
    
    Markdown is turned off in code blocks:
     [This is not a link](http://example.com)

To create not a block, but an inline code span, use backticks:

Here is some inline `code`.
For more help see http://daringfireball.net/projects/markdown/syntax

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>