(2)树莓派挂载外部硬盘
树莓派开机后挂载外部硬盘
Disk identifier: C86B6479-2681-49A4-813B-01E471FEC4CE A4T
Disk identifier: AE83D4B1-1061-4698-80C1-1AA9837D6E12 B4T
通常fdisk -l 查看硬盘
Disk /dev/sda: 3.7 TiB, 4000787030016 bytes, 7814037168 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: gpt
Disk identifier: C86B6479-2681-49A4-813B-01E471FEC4CE
Device Start End Sectors Size Type
/dev/sda1 34 262177 262144 128M Microsoft reserved
/dev/sda2 264192 7814035455 7813771264 3.7T Microsoft basic data
Partition 1 does not start on physical sector boundary.
Disk /dev/sdb: 3.7 TiB, 4000787030016 bytes, 7814037168 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: gpt
Disk identifier: AE83D4B1-1061-4698-80C1-1AA9837D6E12
Device Start End Sectors Size Type
/dev/sdb1 34 262177 262144 128M Microsoft reserved
/dev/sdb2 264192 7814035455 7813771264 3.7T Microsoft basic data
Partition 1 does not start on physical sector boundary.
可以查看到右2个硬盘每个硬盘有2个分区
但是挂载的时候回出现问题,应为是4T的硬盘
➜ ~ mount -t ntfs /dev/sda2 /mnt/A4T/
mount: wrong fs type, bad option, bad superblock on /dev/sda2,
missing codepage or helper program, or other error
In some cases useful info is found in syslog - try
dmesg | tail or so.
出现以上问题后通过以下命令查看具体问题, 可以查看 提示硬盘超过3T 太大不支持
~ dmesg |tail
[ 2812.520144] ntfs: (device sda2): parse_ntfs_boot_sector(): Volume size (3TiB) is too large for this architecture. Maximum supported is 2TiB. Sorry.
[ 2812.520157] ntfs: (device sda2): ntfs_fill_super(): Unsupported NTFS filesystem.
那么我们需要添加新的工具来让系统支持
sudo apt-get install ntfs-3g
安装好后可以正常挂载了, 也是费了一番功夫去查到
➜ ~ mount -t ntfs /dev/sdb2 /mnt/B4T
The disk contains an unclean file system (0, 0).
The file system wasn't safely closed on Windows. Fixing.
自动挂载
每次手动挂载挺麻烦的.这时候需要进行自动挂载了
自动挂载涉及到文件/etc/fstab (file system table)和/etc/mtab
➜ /mnt cat /etc/fstab
# device mount_point filesystem parameters dump fsck
proc /proc proc defaults 0 0
PARTUUID=dee441a9-01 /boot vfat defaults 0 2
PARTUUID=dee441a9-02 / ext4 defaults,noatime 0 1
# a swapfile is not a swap partition, no line here
# use dphys-swapfile swap[on|off] for that
device 设备名或者卷标
mount point 需要被挂载的点
filesystem 文件系统类型 ext2, ext3, ntfs 等
parameters 文件系统参数,设置可读写等 默认defaults
dump 是否作为备份等操作 0 不备份 1 每天备份 默认0
fsck 是否检测扇区 0 不检测 1 检测 2 检测,但是比1检测时间晚
不够以防万一如果写错了 会开机到单用户模式,无法进行任何操作所有文件均为readonly状态
则需要重新挂载根目录
mount -n -o remount,rw /