Automatically mount partitions when Ubuntu is started

Source: Internet
Author: User

First, check the system disk code:

Fdisk-ldisk/dev/SDA: 120.0 GB, 120034123776 bytes255 heads, 63 sectors/track, 14593 cylinders, total 234441648 sectorsunits = sector of 1*512 = 512 bytessector size (logical/physical): 512 bytes/512 bytesi/o size (minimum/optimal): 512 bytes/512 bytesdisk identifier: 0x000214d1 device start end block number ID system/dev/sda1 * 2048 217925631 108961792 83 Linux/dev/sda2 217927678 234440703 8256513 5 extensions/dev/sda5 2 17927680 234440703 8256512 82 Linux swap/solarisdisk/dev/SDB: 500.1 GB, 500107862016 bytes255 heads, 63 sectors/track, 60801 cylinders, total 976773168 sectorsunits = sector of 1*512 = 512 bytessector size (logical/physical): 512 bytes/4096 bytesi/o size (minimum/optimal): 4096 bytes/4096 bytesdisk identifier: 0xec689ddc device start end block number ID system/dev/sdb1 2052 471040703 235519326 7 HPFs/NTFS/exfat Partition 1 does not start with the physical sector boundary. /Dev/sdb2 471040704 976770467 252864882 7 HPFs/NTFS/exfatdisk/dev/SDC: 8178 MB, 8178892800 bytes92 heads, 57 sectors/track, 3046 cylinders, total 15974400 sectorsunits = sector of 1*512 = 512 bytessector size (logical/physical): 512 bytes/512 bytesi/o size (minimum/optimal): 512 bytes/512 bytesdisk identifier: 0x16c0ca45 device start end block number ID system/dev/sdc1 * 1552 15974399 7986424 B w95 FAT32
Note: the root directory/must be mounted before other directories.

Other mount points must be created directories.

Run the following command to view the uuid of another disk:

sudo  blkid
The result is as follows:

/dev/sda1: UUID="70fb376c-17c2-4ce1-a263-727f647949cf" TYPE="ext4" /dev/sda5: UUID="0c5f073a-ad3f-414f-85c2-4af83f6a437f" TYPE="swap" /dev/sdb1: UUID="11263962-9715-473f-9421-0b604e895aaa" TYPE="ext4" /dev/sdb2: UUID="88928fea-5dd3-47b1-9931-bb107d74371e" TYPE="ext4"
Next, modify the automatically mounted configuration file:

sudo vim /etc/fstab
Modify as follows:

UUID=70fb376c-17c2-4ce1-a263-727f647949cf /               ext4    errors=remount-ro 0       1# swap was on /dev/sda5 during installationUUID=0c5f073a-ad3f-414f-85c2-4af83f6a437f none            swap    sw              0       0UUID=11263962-9715-473f-9421-0b604e895aaa /data               ext4    defaults 0       1UUID=88928fea-5dd3-47b1-9931-bb107d74371e /export               ext4    defaults 0       1
The last two actions are newly added mount points.
Note: Do not set the Mount directory to/. If it overwrites the original root directory, the system will crash.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.