一、查看分区
ju@musicoder:~$ sudo fdisk -l[sudo] password for ju:Disk /dev/sda: 250.1 GB, 250059350016 bytes240 heads, 63 sectors/track, 32301 cylindersUnits = cylinders of 15120 * 512 = 7741440 bytesSector size (logical/physical): 512 bytes / 512 bytesI/O size (minimum/optimal): 512 bytes / 512 bytesDisk identifier: 0x77777777Device Boot Start End Blocks Id System/dev/sda1 * 1 3468 26218048+ 7 HPFS/NTFS/dev/sda2 3469 32300 217969889+ f W95 Ext'd (LBA)/dev/sda5 3469 13464 75569728+ 7 HPFS/NTFS/dev/sda6 13465 20399 52428568+ 7 HPFS/NTFS/dev/sda7 20400 27334 52428568+ 7 HPFS/NTFS/dev/sda8 27335 27473 1050808+ 82 Linux swap / Solaris/dev/sda9 27474 27500 204088+ 83 Linux/dev/sda10 27501 30968 26218048+ 83 Linux/dev/sda11 30969 32300 10069888+ 83 Linux
可以看到,硬盘被我分了四个Linux分区,四个NTFS分区
二、查看UUID
ju@musicoder:~$ sudo blkid/dev/sda1: LABEL="win" UUID="6E105E80105E4F69" TYPE="ntfs"/dev/sda5: LABEL="soft" UUID="64F47CE6F47CBC3C" TYPE="ntfs"/dev/sda6: LABEL="work" UUID="3C20C09B20C05E10" TYPE="ntfs"/dev/sda7: LABEL="document" UUID="DA68CADA68CAB493" TYPE="ntfs"/dev/sda8: UUID="282e669c-beec-4768-b75d-39ae089fbca2" TYPE="swap"/dev/sda9: UUID="54430890-54bb-4426-aa0c-f4d474eb50c4" TYPE="ext3"/dev/sda10: UUID="af6a6d5d-c16b-4b8d-a29d-2aa6f12b6de2" TYPE="ext3"/dev/sda11: UUID="70abe683-c21d-48f0-90fa-d0ee72c03b51" TYPE="ext3"ju@musicoder:~$
三、创建挂载目录
ju@musicoder:~$ sudo mkdir /mnt/d /mnt/e /mnt/fju@musicoder:~$ ls /mnt/d e fju@musicoder:~$
四、编辑/etc/fstab文件(别忘了备份)
ju@musicoder:~$ cd /etc/ju@musicoder:/etc$ sudo cp fstab fstab_back_101118ju@musicoder:/etc$ sudo gedit fstab
五、这是打开后的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/sda10 during installationUUID=af6a6d5d-c16b-4b8d-a29d-2aa6f12b6de2 / ext3 errors=remount-ro 0 1# /boot was on /dev/sda9 during installationUUID=54430890-54bb-4426-aa0c-f4d474eb50c4 /boot ext3 defaults 0 2# /home was on /dev/sda11 during installationUUID=70abe683-c21d-48f0-90fa-d0ee72c03b51 /home ext3 defaults 0 2# swap was on /dev/sda8 during installationUUID=282e669c-beec-4768-b75d-39ae089fbca2 none swap sw 0 0
在后面加入下面内容用于自动挂载
UUID=64F47CE6F47CBC3C /mnt/d ntfs defaults,codepage=936,iocharset=gb2312 0 0UUID=3C20C09B20C05E10 /mnt/e ntfs defaults,codepage=936,iocharset=gb2312 0 0UUID=DA68CADA68CAB493 /mnt/f ntfs defaults,codepage=936,iocharset=gb2312 0 0
当然,有些人也按下面的方法加入,肯定也是可以的
/dev/sda5 /mnt/d ntfs user,nls=utf8,umask=0222,gid=1000,auto 0/dev/sda6 /mnt/e ntfs user,nls=utf8,umask=0222,gid=1000,auto 0/dev/sda7 /mnt/f ntfs user,nls=utf8,umask=0222,gid=1000,auto 0
六、重新启动后进入/mnt/会发现挂载好的分区
ju@musicoder:/etc$ sudo shutdown -r now
七、如果要把分区放到桌面上,可以链接一下就行
ju@musicoder:~$ ln -s /mnt/e /home/ju/desktop/e
这时会在桌面上发现挂载的windows分区
八、更好的方法(对个人)
自己使用的是Ubuntu(10.04LTS),在将分区挂载到/media/下面会自动有桌面图标打开分区,所以把分区挂载到/media/下面是更好的方法
1.创建挂载目录
ju@musicoder:/media$ sudo mkdir d e f[sudo] password for ju:ju@musicoder:/media$ lsd e fju@musicoder:/media$
2.编辑fstab,把挂载的分区改成 /media/下面:
UUID=64F47CE6F47CBC3C /media/d ntfs defaults,codepage=936,iocharset=gb2312 0 0UUID=3C20C09B20C05E10 /media/e ntfs defaults,codepage=936,iocharset=gb2312 0 0UUID=DA68CADA68CAB493 /media/f ntfs defaults,codepage=936,iocharset=gb2312 0 0
3.以前建立的/mnt/下面的dir都可以删了。