Within the Linux virtual machine, the additional data disk blocks in the device name (/dev/SDXX) way of creating the file system, and will be written to the/etc/fstab file to realize automatic start function of mount, but after the restart the virtual machine will appear random device name do not match the file system and the actual problem,
Problem analysis
Due to the Azure virtual machine in the process of start, randomly assigned data disk SCSI address, caused the data disk after additional, obtain the SCSI address will random changes, such as the original data to disk. A, the initial equipment called/dev/SDC, after the restart, randomly assigned for/dev/SDD, the original data disk B, the initial equipment called/dev/SDD, after the restart, assigned to/dev/SDC, so, if the customer through the device automatically mount, then will see hardpoints under the actual data is inconsistent,
Solution
In order to avoid the above design lead to automatically mount when the fault occurs, it is recommended to use UUID to replace the device name, the UUID of different file system is not changed by restart, such, can ensure that every automatically mount to the right file system mounted on the right hardpoints,
According to the following command to get the file system's UUID:
# blkid
/dev/sdb1: UUID="f788cc09 - df9 fad5-4-9360 - ffe39d82 * * * *" TYPE="corruption"
/dev/sda1: UUID="9 bb6e11f - 4697-476 - a - 9 e71 0 ebfff61 * * * *" TYPE="XFS
"/dev/sda2: UUID="445 d96a9 - aeb1-4623 - a2db - be133bdf * * * *" TYPE="XFS
"
According to the following format written to the/etc/fstab file:
# cat/etc/fstab
...
...
UUID=445 d96a9 - aeb1-4623 - a2db - be133bdf * * * */XFS defaults 0 0
UUID=9 bb6e11f - 4697-476 - a - 9 e71 0 ebfff61 * * * */boot XFS defaults 0 0
More parameter Settings, you can refer to here,
CodePudding user response:
Can use UUID definition in the/etc/fstab view UUDI command idblk, copy in it