硬盘自动挂载的配置

2020-03-12  本文已影响0人  semiscone

查看Linux硬盘信息

$ sudo fdisk -l 

格式化硬盘

bill@ubuntu:~/workspace$ sudo mkfs.ntfs /dev/sda1
Cluster size has been automatically set to 4096 bytes.

创建目录

sudo mkdir workspace

挂载分区

sudo mount /dev/sda1 /home/bill/workspace

查看磁盘分区的UUID

bill@ubuntu:~$ sudo blkid
/dev/sdb1: UUID="2164-8C87" TYPE="vfat" PARTLABEL="EFI System Partition" PARTUUID="e9536cee-0c2d-4034-8f92-85e5108a504b"
/dev/sdb2: UUID="fd2ed67d-bd20-4687-a298-fcda8131f65b" TYPE="ext4" PARTUUID="52998736-dfbc-4632-b533-3e6d02aeddd3"
/dev/sdc1: LABEL="My Passport" UUID="E862FD9862FD6C26" TYPE="ntfs" PARTLABEL="My Passport" PARTUUID="fcd70889-36c0-45f9-a75d-3383a16a8fd3"
/dev/sdd1: LABEL="Blue" UUID="DC381DA8381D8326" TYPE="ntfs" PARTLABEL="Basic data partition" PARTUUID="fef2592b-701f-47d4-93a3-36fb70553238"
/dev/sda1: UUID="3A1BD1D77BF52AE8" TYPE="ntfs" PTTYPE="dos" PARTUUID="69159000-01"

配置开机自动挂载:

mount命令重启后会失效,将分区信息写入 /etc/fstab 文件启动自动挂载

sudo vi /etc/fstab

# /etc/fstab: static file system information.
#
# <file system>         <mount point>           <type>  <options>       <dump>  <pass>
UUID=3A1BD1D77BF52AE8   /home/bill/workspace    ntfs    defaults        0       1

验证配置

sudo mount -a
上一篇下一篇

猜你喜欢

热点阅读