Auto-mounting Windows Partition

如果保持着 Windows 和 Ubuntu 的共存,那么常见的做法就是将数据(比如文档、音乐等)放在某个分区上,Windows 和 Ubuntu 这两个系统都使用这个共同的分区。当然,这个分区得使用 Windows 能识别的格式,比如 FAT32。

Ubuntu 在启动时并不自动挂载 Windows 分区,这导致每次 Ubuntu 启动后都需要手动挂载。虽然操作蛮简单,但总这么做很烦人、也显得很没 IQ…

1. 寻找 UUID

在 Nautilus 中挂载这个 Windows 分区后,切换至 计算机 视图,右击该驱动器,打开 属性,切换到 Volume 标签,就可以找到这个 Windows 分区的 UUID。我的 Windows D 盘是 848D-0A78。

[UPDATE] 28 June 2010
更好的方法是使用 blkid 指令来查找 UUID,比如:
$ sudo blkid /dev/sda2
你将会看到类似的输出:
/dev/sda2: LABEL=”DATA” UUID=”C21879CA1879BDCB” TYPE=”ntfs”

2. 创建挂载点

我打算将 Windows D 盘挂载到 /media/DATA

$ cd /media
$ sudo mkdir DATA

3. 编辑 fstab 文件

打开 /etc/fstab 文件,按其格式,加入一行新行以自动挂载(以下我按列分开写,因为这行太长)。

<file system> UUID=848D-0A78
<mount point> /media/DATA
<type> vfat
<options> defaults,codepage=936,iocharset=utf8,fmask=0133,dmask=0022,uid=1000,gid=1000
<dump> 0
<pass> 0

说明:
这里我使用的用户帐号对应的 uid/gid 是 1000/1000。请打开 用户和组 管理器(或查看 /etc/passwd 和 /etc/group)以确认你使用的用户帐号的 uid/gid。

This entry was posted in Linux and tagged . Bookmark the permalink.

Leave a Reply

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

*

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> <pre lang="" line="" escaped="">