[manjaro 02] 自动挂载的硬盘
- 首先打开终端运行命令
sudo fdisk -l查看列表,找到自己要挂载的硬盘,挂载如下盘:
Disk /dev/sda:238.47 GiB,256060514304 字节,500118192 个扇区
磁盘型号:KINGSTON SKC6002
单元:扇区 / 1 * 512 = 512 字节
扇区大小(逻辑/物理):512 字节 / 4096 字节
I/O 大小(最小/最佳):4096 字节 / 4096 字节
磁盘标签类型:gpt
磁盘标识符:EFA58E79-0194-4879-B1FC-C39CF76EE297
设备 起点 末尾 扇区 大小 类型
/dev/sda1 4096 618495 614400 300M EFI 系统
/dev/sda2 618496 500117503 499499008 238.2G Microsoft 基本数据
挂载分区 /dev/sda2 。
对了,还要安装 ntfs-3g 这个包,已安装的就不用再安装了。
2.运行命令 ls -l /dev/disk/by-uuid/ 查看 UUID
ls -l /dev/disk/by-uuid/
总计 0
lrwxrwxrwx 1 root root 11 1月20日 11:11 2020-04-06-13-39-41-00 -> ../../loop0
lrwxrwxrwx 1 root root 10 1月20日 11:07 57f93a38-7e66-446f-9741-ce6a4deaf5cc -> ../../sdb2
lrwxrwxrwx 1 root root 10 1月20日 11:07 9497-6702 -> ../../sdb1
lrwxrwxrwx 1 root root 10 1月20日 11:07 9697-EA38 -> ../../sda1
lrwxrwxrwx 1 root root 10 1月20日 11:07 E38AF74339DEDEC4 -> ../../sda2
E38AF74339DEDEC4 这个就是/dev/sda2 对应的UUID,记录下来。
- 编辑
/etc/fstab文件
注意,这个文件要正确修改其内容,否则会开不了机,需要通过 liveCD 进行修复,进入 liveCD 挂载(mount)系统分区,然后编辑 /etc/fstab 删除你添加的内容然后保存。
我的挂载点是 /home/shun/data (可自己定义),先创建个 data 目录:
mkdir /home/shun/data
运行命令sudo nano /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>
UUID=0e7efab8-cafd-41ac-add7-323d8cec18ec / ext4 defaults,noatime,discard 0 1
UUID=410db31f-06e6-489d-89cc-e477e8702e76 swap swap defaults,noatime,discard 0 2
tmpfs /tmp tmpfs defaults,noatime,mode=1777 0 0
在文件最后一行添加挂载分区:
UUID=这里是刚刚查询出来的UUID 要挂载到的目录 ntfs defaults 0 0
我的示例:
UUID=E38AF74339DEDEC4 /home/shun/data ntfs defaults 0 0
注意有空格。
UUID是刚刚查询出来的
/home/shun/data表示挂载点
ntfs表示文件系统,小写
0 0表示开机不检查磁盘。
修改后内容
# /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>
UUID=0e7efab8-cafd-41ac-add7-323d8cec18ec / ext4 defaults,noatime,discard 0 1
UUID=410db31f-06e6-489d-89cc-e477e8702e76 swap swap defaults,noatime,discard 0 2
tmpfs /tmp tmpfs defaults,noatime,mode=1777 0 0
UUID=E38AF74339DEDEC4 /home/shun/data ntfs defaults 0 0
Ctrl+S保存,Ctrl+X退出文本编辑。
reboot重启。
可运行命令 df -h 查看挂载情况
文件系统 容量 已用 可用 已用% 挂载点
dev 7.8G 0 7.8G 0% /dev
run 7.8G 1.4M 7.8G 1% /run
/dev/sdb1 100G 46G 50G 48% /
tmpfs 7.8G 61M 7.8G 1% /dev/shm
tmpfs 7.8G 0 7.8G 0% /sys/fs/cgroup
tmpfs 7.8G 19M 7.8G 1% /tmp
/dev/sda3 932G 4.2G 928G 1% /home/shun/data
tmpfs 1.6G 16K 1.6G 1% /run/user/1000
Win10, Manjaro双系统,需要进去Win10,关闭快速启动(避免变成只读)

浙公网安备 33010602011771号