Linux系统通过UUID挂载硬盘分区

一、查看分区表信息

1.命令:sudo blkid

Fighter:~$ sudo blkid
/dev/sda1: UUID="4C7A269D7A2683B4" TYPE="ntfs" PARTUUID="b9b1b5b6-01"
/dev/sda2: LABEL="M-fM-^\M-,M-eM-^\M-0M-gM-#M-^AM-gM-^[M-^X" UUID="666C3B416C3B0B77" TYPE="ntfs" PARTUUID="b9b1b5b6-02"
/dev/sda5: UUID="97382d3e-ac64-4b04-8714-d60502478c64" TYPE="swap" PARTUUID="b9b1b5b6-05"
/dev/sdb1: UUID="37762580-d3f0-40d0-acaa-990037c64636" TYPE="ext4" PARTUUID="0006e551-01"
/dev/sdb2: UUID="19dffa39-2886-4771-996e-62b1b3a77ceb" TYPE="swap" PARTUUID="0006e551-02"
/dev/sdb3: LABEL="work" UUID="201313e2-2ffa-424e-98ee-9f5a18cf3b8d" TYPE="ext4" PARTUUID="0006e551-03"
/dev/sdd: LABEL="SourceCode" UUID="a7b70f5c-cc52-4d81-bb85-fd1775ef675b" TYPE="ext4" PTUUID="e5941a27" PTTYPE="dos"
/dev/sdc1: LABEL="M-gM-3M-;M-gM-;M-^_M-dM-?M-^]M-gM-^UM-^Y" UUID="02D4781FD47816DF" TYPE="ntfs" PARTUUID="efc7223a-01"
/dev/sdc2: UUID="0A1CCC511CCC3989" TYPE="ntfs" PARTUUID="efc7223a-02"
/dev/sdc3: UUID="22FE200AFE1FD4BF" TYPE="ntfs" PARTUUID="efc7223a-03"

二、创建要挂载到的文件夹

三、编辑/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).
#
#                
# / was on /dev/sdb1 during installation
UUID=37762580-d3f0-40d0-acaa-990037c64636 /               ext4    errors=remount-ro 0       1
# swap was on /dev/sda5 during installation
UUID=97382d3e-ac64-4b04-8714-d60502478c64 none            swap    sw              0       0
# swap was on /dev/sdb2 during installation
UUID=19dffa39-2886-4771-996e-62b1b3a77ceb none            swap    sw              0       0
# work was on /dev/sdb3 during installation
UUID=201313e2-2ffa-424e-98ee-9f5a18cf3b8d /home/koson/Work          ext4    defaults        0       2
#SourceCode was on /dev/sdd during installation
UUID=a7b70f5c-cc52-4d81-bb85-fd1775ef675b /home/koson/SourceCode    ext4    defaults        0       2

 

你可能感兴趣的:(linux系统使用)