在 OpenWRT 中挂载读写 HFS+ 驱动器

在 OpenWRT 中挂载读写 HFS+ 驱动器

我将从 Mac 上卸下的“旧”SSD 驱动器连接到我的塔里斯奥姆尼亚通过其两个 USB 3 端口之一。

虽然我已经能够安装该设备,但它处于只读模式。我似乎无法以读/写模式安装它。

脚步:

识别驱动器:

root@turris:/# fdisk -l

Disk /dev/mtdblock0: 1 MiB, 1048576 bytes, 2048 sectors 
Units: sectors of 1 * 512 = 512 bytes 
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes 
Disk /dev/mtdblock1: 7 MiB, 7340032 bytes, 14336 sectors 
Units: sectors of 1 * 512 = 512 bytes 
Sector size (logical/physical): 512 bytes / 512 bytes 
I/O size (minimum/optimal): 512 bytes / 512 bytes 
Disk /dev/mmcblk0: 7.3 GiB, 7818182656 bytes, 15269888 sectors 
Units: sectors of 1 * 512 = 512 bytes 
Sector size (logical/physical): 512 bytes / 512 bytes 
I/O size (minimum/optimal): 512 bytes / 512 bytes 
Disklabel type: dos 
Disk identifier: 0x77f5941d

Device         Boot Start      End  Sectors  Size Id Type
/dev/mmcblk0p1       2048 15269887 15267840  7.3G 83 Linux

Disk /dev/mmcblk0boot1: 4 MiB, 4194304 bytes, 8192 sectors 
Units: sectors of 1 * 512 = 512 bytes 
Sector size (logical/physical): 512 bytes / 512 bytes 
I/O size (minimum/optimal): 512 bytes / 512 bytes 
Disk /dev/mmcblk0boot0: 4 MiB, 4194304 bytes, 8192 sectors 
Units: sectors of 1 * 512 = 512 bytes 
Sector size (logical/physical): 512 bytes / 512 bytes 
I/O size (minimum/optimal): 512 bytes / 512 bytes 
Disk /dev/sda: 465.9 GiB, 500277790720 bytes, 977105060 sectors 
Units: sectors of 1 * 512 = 512 bytes 
Sector size (logical/physical): 512 bytes / 512 bytes 
I/O size (minimum/optimal): 512 bytes / 512 bytes 
Disklabel type: gpt 
Disk identifier: 6FD6A401-727C-43A0-92A5-XXXXXXXXXX

Device      Start       End   Sectors   Size Type
/dev/sda1      40    409639    409600   200M EFI System
/dev/sda2  409640 976842879 976433240 465.6G Apple HFS/HFS+

安装驱动器:

root@turris:/# mount -t hfsplus /dev/sda2 /mnt/jetdrive

列出驱动器的内容:

root@turris:/# ls -al /mnt/jetdrive
drwxrwxr-x    1 root     root            13 Nov 13 10:07 .
drwxr-xr-x    1 root     root            44 Nov 13 20:37 ..
-rw-r--r--    1 99       99           10244 Nov 13 10:10 .DS_Store
dr-xr-xr-t    1 root     root             2 Nov 13 10:06 .HFS+ Private Directory Data?
drwx------    1 99       99               5 Nov 13 10:06 .Spotlight-V100
drwx------    1 99       99               5 Nov 13 10:11 .fseventsd
----------    1 root     root      41943040 Nov 13 10:06 .journal
----------    1 root     root          4096 Nov 13 10:06 .journal_info_block
drwxr-xr-x    1 99       99               5 Nov 13 10:10 Music
drwxr-xr-x    1 99       99               4 Nov 13 10:09 Pictures

创建一个文件:

root@turris:/mnt# touch /mnt/jetdrive foobar
touch: /mnt/jetdrive: Read-only file system

我尝试了此中列出的方法回答,但这会导致问题:

root@turris:/mnt# mount -t hfsplus -o remount,rw /dev/sda2 /mnt/jetdrive
mount: /mnt/jetdrive not mounted or bad option

       In some cases useful info is found in syslog - try
       dmesg | tail or so.

我究竟做错了什么? HFS+驱动器可以以读/写方式安装吗?

答案1

ro我的 HFS+ 驱动器仅在断电后以只读 ( ) 方式重新安装。您可以在启动日志中看到这一点:

dmesg | grep hfsplus
# [    8.421832] hfsplus: Filesystem was not cleanly unmounted, running fsck.hfsplus is recommended.  mounting read-only.

我通过添加一个小脚本来/etc/rc.local卸载、运行fsck.hfsplus并在启动时重新安装来解决这个问题。奇迹般有效。

{
    echo "*** Mounted dirs *************************"
    ls /mnt
    echo "*** Unmounting disk **********************"
    umount /mnt/samsungT5
    echo "*** Performing fsck **********************"
    fsck.hfsplus /dev/sda1
    echo "*** Remounting disk **********************"
    mount -t hfsplus -o rw /dev/sda1 /mnt/samsungT5
    echo "*************************"
} 2>&1 > /tmp/rc.local.log

答案2

有类似的问题。尝试安装建议的软件包这里没有成功。我最终重新格式化了磁盘并禁用了日志记录(就像我第一次做的那样)并且它起作用了。第二次,我确保在将磁盘与我正在使用的 Mac 断开连接之前安全卸载磁盘

答案3

似乎不仅仅是日志和不干净的卸载导致了问题。

检查文件系统并将其修复为干净后,在路由器上仍然:

dmesg | grep hfs
[ 1728.605465] hfsplus: write access to a journaled filesystem is not supported, use the force option at your own risk, mounting read-only.

添加此解决Mount optionsSystem/Mount Points问题:

force,rw,noatime

现在mount命令显示:

/dev/sda1 on /mnt/sda1 type hfsplus (rw,noatime,umask=0,uid=0,gid=0,nls=utf8)

再次启动 SAMBA

service samba start

smb://routername_or_ip 并通过Windows访问路由器共享驱动器,然后\\routername_or_ip 我就可以写入文件了。

希望能帮助到你。

相关内容