傳統的硬碟自動掛載會透過fastab進行。
但如果在硬體部分有經過更換,有可能會出現硬碟代號更動
(例如有一顆sda掛掉了,把這顆硬碟卸下以後,原本的sdb就變成sda,導致無法順利開機)
要避免這狀況就是在fstab進行掛載時,使用UUID (Universally Unique Identifiers)。
sudo blkid
底下就會列出
如果是硬碟裝置,後面就會出現UUID。
接下來就只要修改對應的UUID到fstab當中。寫法有兩種,
/etc/fstab
# /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>
/dev/disk/by-uuid/345db9ac-d009-4d96-9axxxxxxxxxxxxxxx / ext4 defaults 0 1
UUID=345db9ac-d009-4d96-9axxxxxxxxxxxxxxx /mnt ext4 defaults 0 1
ref:
https://www.alibabacloud.com/help/en/ecs/use-cases/configure-uuids-in-the-fstab-file-to-automatically-attach-data-disks
沒有留言:
張貼留言