1, 首先摸清我系统的硬盘分区等使用情况
sudo fdisk -l
Disk /dev/sda: 128.0 GB, 128035676160 bytes
255 heads, 63 sectors/track, 15566 cylinders, total 250069680 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00097397
Device Boot Start End Blocks Id System
/dev/sda1 * 2048 233476095 116737024 83 Linux
/dev/sda2 233478142 250068991 8295425 5 Extended
/dev/sda5 233478144 250068991 8295424 82 Linux swap / Solaris
Disk /dev/sdb: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 cylinders, total 976773168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk identifier: 0x621867fe
Device Boot Start End Blocks Id System
/dev/sdb1 * 63 92164904 46082421 7 HPFS/NTFS/exFAT
Partition 1 does not start on physical sector boundary.
/dev/sdb2 92166144 840998911 374416384 83 Linux
/dev/sdb3 841003008 976773167 67885080 7 HPFS/NTFS/exFAT
sudo blkid
/dev/sda1: UUID="d89cb536-6aee-4f32-90de-7f1d50c56028" TYPE="ext4"
/dev/sda5: UUID="23776989-f354-4ffc-9d3b-c299afe9c6dd" TYPE="swap"
/dev/sdb1: UUID="D6B6542EB65410FB" TYPE="ntfs"
/dev/sdb2: LABEL="woks" UUID="6e29fd49-6443-4048-bc4d-d9a391bf2ce9" TYPE="ext4"
/dev/sdb3: LABEL="winapp" UUID="1ADE5534DE550981" TYPE="ntfs"
我需要挂在的是sdb2和sdb3这两个分区
2,修改分区挂在配置表
打开/etc/fstab
配置文件包含以下几项:
<file system> <mount point> <type> <options> <dump> <pass>
<file system> :分区定位,可以给磁盘号,UUID或LABEL,例如:/dev/sda2,UUID=6E9ADAC29ADA85CD或LABEL=software
<mount point> : 具体挂载点的位置,例如:/media/C
<type> : 挂载磁盘类型,linux分区一般为ext4,windows分区一般为ntfs
<options> : 挂载参数,一般为defaults
<dump> : 磁盘备份,默认为0,不备份
<pass> : 磁盘检查,默认为0,不检查
根据情况,我们做如下修改
# /etc/fstab: static file system information.
#
# Use 'blkid' 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>
# / was on /dev/sda1 during installation
UUID=d89cb536-6aee-4f32-90de-7f1d50c56028 / ext4 errors=remount-ro 0 1
# swap was on /dev/sda5 during installation
UUID=23776989-f354-4ffc-9d3b-c299afe9c6dd none swap sw 0 0
#work was on /dev/sdb2
UUID=6e29fd49-6443-4048-bc4d-d9a391bf2ce9 /media/zangcf/works ext4 errors=remount-ro 0 0
#winapp was on /dev/sdb3
UUID=1ADE5534DE550981 /media/zangcf/winapp ntfs errors=remount-ro 0 0
3, 检查并挂载新添项
手动卸载已经挂载的硬盘,然后
cd /media/zangcf
sudo mkdir winapp
sudo mkdir works
sudo mount -a
mount -a会/etc/fstab中的项全部挂载,如果有错,则会提示错误,然后根据错误找出原因修改。