Ubuntu開機自動掛載分區

來源:互聯網
上載者:User

Ubuntu開機自動掛載分區

首先,查看系統的磁碟代號:

fdisk -lDisk /dev/sda: 120.0 GB, 120034123776 bytes255 heads, 63 sectors/track, 14593 cylinders, total 234441648 sectorsUnits = 扇區 of 1 * 512 = 512 bytesSector size (logical/physical): 512 bytes / 512 bytesI/O size (minimum/optimal): 512 bytes / 512 bytesDisk identifier: 0x000214d1   裝置 啟動      起點          終點     塊數   Id  系統/dev/sda1   *        2048   217925631   108961792   83  Linux/dev/sda2       217927678   234440703     8256513    5  擴充/dev/sda5       217927680   234440703     8256512   82  Linux 交換 / SolarisDisk /dev/sdb: 500.1 GB, 500107862016 bytes255 heads, 63 sectors/track, 60801 cylinders, total 976773168 sectorsUnits = 扇區 of 1 * 512 = 512 bytesSector size (logical/physical): 512 bytes / 4096 bytesI/O size (minimum/optimal): 4096 bytes / 4096 bytesDisk identifier: 0xec689ddc   裝置 啟動      起點          終點     塊數   Id  系統/dev/sdb1            2052   471040703   235519326    7  HPFS/NTFS/exFAT分區 1 未起始於物理扇區邊界。/dev/sdb2       471040704   976770467   252864882    7  HPFS/NTFS/exFATDisk /dev/sdc: 8178 MB, 8178892800 bytes92 heads, 57 sectors/track, 3046 cylinders, total 15974400 sectorsUnits = 扇區 of 1 * 512 = 512 bytesSector size (logical/physical): 512 bytes / 512 bytesI/O size (minimum/optimal): 512 bytes / 512 bytesDisk identifier: 0x16c0ca45   裝置 啟動      起點          終點     塊數   Id  系統/dev/sdc1   *        1552    15974399     7986424    b  W95 FAT32
注意:根目錄/一定要先於其他目錄被掛載起來。

其他的掛載點必須為已建立好的目錄。

使用如下命令查看其他磁碟的UUID:

sudo  blkid
結果如下: 
/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"
接下來修改自動掛載的設定檔: 
sudo vim /etc/fstab
修改如下:
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
最後兩行為新加的掛載點。
注意,千萬不要將掛載目錄設定為/,否在會覆蓋原有的根目錄,系統就會掛掉。

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

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.