2024年5月21日 星期二

使用UUID進行硬碟掛載

 傳統的硬碟自動掛載會透過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

沒有留言:

張貼留言

agy進入auto-mode

 以前的agy可以透過ctrl-tab進行模式切換。最近更新把auto mode從這個切換中拿掉了,頂多讓agent寫寫文件,但是不讓agent去跑程式。解決辦法就是要從一開始就決定進入session的時候要不要開auto mode: agy --dangerously-skip...