ubuntu自动挂载windows分区(装有双系统)

如果你的电脑装了Windows/Ubuntu双系统,你该有这样的体会:当登录Ubuntu时,系统不会自动挂载Windows下的各分区,只能手动挂 载。这难免有些麻烦,并在一定意义上违背了Ubuntu追求简洁的宗旨。本文将介绍如何解决这个问题,以使在登录Ubuntu的同时自动挂载 Windows分区。

1.查看电脑中所有硬盘的分区情况。
命令如下:
sudo fdisk -l
此命令将输出类似如下的信息:
Disk /dev/sda: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0xf0b1ebb0

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1        3825    30724281    7  HPFS/NTFS
/dev/sda2            3826       60802   457661193    f  W95 Ext'd (LBA)
/dev/sda5            3826       16574   102406311    7  HPFS/NTFS
/dev/sda6           16575       29323   102406311    7  HPFS/NTFS
/dev/sda7           29324       54427   201647848+   7  HPFS/NTFS
/dev/sda8           54428       54552      999424   82  Linux swap / Solaris
/dev/sda9           54552       60802    50199552   83  Linux

注:上述列表中/dev/sda1、/dev/sda5、/dev/sda6、/dev/sda7分别代表Windows中的C、D、E、F分区,并记下各分区的文件系统类型。

2.修改/etc/fstab配置文件。
命令如下:
sudo vi /etc/fstab
编辑此配置文件,最终其内容类似如下:
# /etc/fstab: static file system information.
#
# Use 'blkid -o value -s UUID' to print the universally unique identifier
# for a device; this may be used with UUID= as a more robust way to name
# devices that works even if disks are added and removed. See fstab(5).
#
# <file system> <mount point>   <type>  <options>       <dump>  <pass>
proc            /proc           proc    nodev,noexec,nosuid 0       0
# / was on /dev/sda7 during installation
UUID=ac4326f1-50ad-457f-8e99-63174b97bc88 /               ext4    errors=remount-ro 0       1
# swap was on /dev/sda6 during installation
UUID=9026c543-3172-4d21-bce0-dbe595a1425d none            swap    sw              0       0
#auto mount windows fs
/dev/sda1 /media/win-C ntfs nls=utf8,umask=000   0   0
/dev/sda5 /media/win-D ntfs nls=utf8,umask=000   0   0
/dev/sda6 /media/win-E ntfs nls=utf8,umask=000   0   0
/dev/sda7 /media/win-F ntfs nls=utf8,umask=000   0   0

注: 末尾的5行是添加的内容。其中/dev/sda1一行代表C盘分区将自动挂载到/media/win-C目录下,文件系统为NTFS(如果步骤1中查看分 区的文件系统为FAT32时,此处请写vfat),字符编码为utf8。umask表示文件目录的权限,此参数以及之后的2个参数都为0即可。以下几行以 此类推。此处可以选择性的添加需要自动挂载的分区,不想挂载的分区不用书写。

3.重启电脑。
编辑、保存上述配置文件之后,请重启电脑。你将会看到系统已成功挂载Windows各分区。

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章