美文网首页
解决Mac连接移动硬盘为只读状态 【命令行,不借用第三方nftf

解决Mac连接移动硬盘为只读状态 【命令行,不借用第三方nftf

作者: jiaxiaolei | 来源:发表于2022-05-21 00:12 被阅读0次

操作记录:

记录Device Node

方法1: 通过 diskutil info 查看

➜  ~ diskutil info /Volumes/WD-ELEMENTS
   Device Identifier:         disk2s2
   Device Node:               /dev/disk2s2
   Whole:                     No
   Part of Whole:             disk2

   Volume Name:               WD-ELEMENTS
   Mounted:                   Yes
   Mount Point:               /Volumes/WD-ELEMENTS

   Partition Type:            Microsoft Basic Data
   File System Personality:   iboysoft_NTFS
   Type (Bundle):             iboysoft_NTFS
   Name (User Visible):       Windows NTFS

   OS Can Be Installed:       No
   Media Type:                Generic
   Protocol:                  USB
   SMART Status:              Not Supported
   Volume UUID:               CA7BB1B0-7A00-4CF0-8B78-CF72A805F565
   Disk / Partition UUID:     4CC9C681-0AA7-43EE-8692-E915AF670C66
   Partition Offset:          210763776 Bytes (411648 512-Byte-Device-Blocks)

   Disk Size:                 1000.0 GB (999990231040 Bytes) (exactly 1953105920 512-Byte-Units)
   Device Block Size:         512 Bytes

   Volume Total Space:        1000.0 GB (999990226944 Bytes) (exactly 1953105912 512-Byte-Units)
   Volume Used Space:         820.9 GB (820884844544 Bytes) (exactly 1603290712 512-Byte-Units) (82.1%)
   Volume Free Space:         179.1 GB (179105382400 Bytes) (exactly 349815200 512-Byte-Units) (17.9%)
   Allocation Block Size:     4096 Bytes

   Media OS Use Only:         No
   Media Read-Only:           No
   Volume Read-Only:          Yes (read-only mount flag set)

   Device Location:           External
   Removable Media:           Fixed

   Solid State:               Info not available
image.png

方法2:diskutil list

➜  /Volumes diskutil list
/dev/disk0 (internal, physical):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      GUID_partition_scheme                        *500.3 GB   disk0
   1:                        EFI ⁨EFI⁩                     209.7 MB   disk0s1
   2:                 Apple_APFS ⁨Container disk1⁩         500.1 GB   disk0s2

/dev/disk1 (synthesized):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      APFS Container Scheme -                      +500.1 GB   disk1
                                 Physical Store disk0s2
   1:                APFS Volume ⁨Macintosh HD - 数据⁩     465.2 GB   disk1s1
   2:                APFS Volume ⁨Preboot⁩                 283.2 MB   disk1s2
   3:                APFS Volume ⁨Recovery⁩                622.9 MB   disk1s3
   4:                APFS Volume ⁨VM⁩                      1.1 GB     disk1s4
   5:                APFS Volume ⁨Macintosh HD⁩            22.4 GB    disk1s5
   6:              APFS Snapshot ⁨com.apple.os.update-...⁩ 22.4 GB    disk1s5s1

/dev/disk2 (external, physical):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      GUID_partition_scheme                        *1.0 TB     disk2
   1:                        EFI ⁨EFI⁩                     209.7 MB   disk2s1
   2:       Microsoft Basic Data ⁨WD-ELEMENTS⁩             1000.0 GB  disk2s2

方法3: 通过 df -h 查看;

jiaxiaoleideMacBook-Pro:~ root# df -h
Filesystem       Size   Used  Avail Capacity iused      ifree %iused  Mounted on
/dev/disk1s5s1  466Gi   21Gi  7.5Gi    74%  553757 4882923163    0%   /
devfs           195Ki  195Ki    0Bi   100%     674          0  100%   /dev
/dev/disk1s4    466Gi  2.0Gi  7.5Gi    22%       3 4883476917    0%   /System/Volumes/VM
/dev/disk1s2    466Gi  270Mi  7.5Gi     4%     784 4883476136    0%   /System/Volumes/Preboot
/dev/disk1s6    466Gi  108Mi  7.5Gi     2%     394 4883476526    0%   /System/Volumes/Update
/dev/disk1s1    466Gi  434Gi  7.5Gi    99% 3618245 4879858675    0%   /System/Volumes/Data
map auto_home     0Bi    0Bi    0Bi   100%       0          0  100%   /System/Volumes/Data/home
/dev/disk1s5    466Gi   21Gi  7.5Gi    74%  553607 4882923313    0%   /System/Volumes/Update/mnt1
/dev/disk2s2    931Gi  556Gi  375Gi    60%   47570  393878996    0%   /Volumes/WD-ELEMENTS

方法4: 使用方法 mount

jiaxiaoleideMacBook-Pro:~ root# mount
/dev/disk1s5s1 on / (apfs, sealed, local, read-only, journaled)
devfs on /dev (devfs, local, nobrowse)
/dev/disk1s4 on /System/Volumes/VM (apfs, local, noexec, journaled, noatime, nobrowse)
/dev/disk1s2 on /System/Volumes/Preboot (apfs, local, journaled, nobrowse)
/dev/disk1s6 on /System/Volumes/Update (apfs, local, journaled, nobrowse)
/dev/disk1s1 on /System/Volumes/Data (apfs, local, journaled, nobrowse)
map auto_home on /System/Volumes/Data/home (autofs, automounted, nobrowse)
/dev/disk1s5 on /System/Volumes/Update/mnt1 (apfs, sealed, local, journaled, nobrowse)
/dev/disk2s2 on /Volumes/WD-ELEMENTS (ms_ntfs, local, nodev, nosuid, read-only, noowners)

方法5:通过mac 自带的磁盘工具

[图片上传失败...(image-70270d-1655057212392)]

[图片上传失败...(image-310650-1655057310505)]

[图片上传失败...(image-c15143-1655057356272)]

移出移动硬盘挂载

方法1: 使用 umount

➜  ~ sudo umount /Volumes/WD-ELEMENTS
Password:

![image.png](https://img.haomeiwen.com/i1079652/e38a7970b99f559a.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)

方法2: 使用

jiaxiaoleideMacBook-Pro:~ root# hdiutil eject /Volumes/WD-ELEMENTS
"disk2" ejected.

弹出磁盘之后,通过 df 查看 /Volumes/WD-ELEMENTS 已经不存在。

将移动硬盘挂载到指定目录。



新建一个目录:

$ mkdir -p /Users/jiaxiaolei/mount_jia

$ sudo mount -t ntfs -o rw,auto,nobrowse [Device Node] /指定挂载路径
#NOTE: 指定挂载路径应该已存在。比如这里的   /Users/jiaxiaolei/mount_jia
➜  ~ sudo mount -t ntfs -o rw,auto,nobrowse /dev/disk2s2 /Users/jiaxiaolei/mount_jia
Executing: /usr/bin/kmutil load -p /System/Library/Extensions/ntfs.kext

查看 磁盘信息:

➜  mount_jia df -h
Filesystem       Size   Used  Avail Capacity iused      ifree %iused  Mounted on
/dev/disk1s5s1  466Gi   21Gi   15Gi    59%  553757 4882923163    0%   /
devfs           197Ki  197Ki    0Bi   100%     680          0  100%   /dev
/dev/disk1s4    466Gi  5.0Gi   15Gi    25%       6 4883476914    0%   /System/Volumes/VM
/dev/disk1s2    466Gi  270Mi   15Gi     2%     784 4883476136    0%   /System/Volumes/Preboot
/dev/disk1s6    466Gi  108Mi   15Gi     1%     394 4883476526    0%   /System/Volumes/Update
/dev/disk1s1    466Gi  424Gi   15Gi    97% 3653182 4879823738    0%   /System/Volumes/Data
map auto_home     0Bi    0Bi    0Bi   100%       0          0  100%   /System/Volumes/Data/home
/dev/disk2s1    102Mi   75Mi   27Mi    74%     307 4294966972    0%   /Volumes/Snipaste
/dev/disk3s2    931Gi  764Gi  167Gi    83%   51331  175286657    0%   /Users/jiaxiaolei/mount_jia
image.png

打开资源管理器:
➜ ~ cd /Users/jiaxiaolei/mount_jia
➜ mount_jia open .
➜ mount_jia pwd

不用的时候,可以通过umount 移除

sudo umount /Users/jiaxiaolei/mount_jia

常见问题

  1. 挂载点的目录必须存在。如果不存在,则需要先建立
$ sudo mount -t ntfs -o rw,auto,nobrowse /dev/disk2s2 /Users/jiaxiaolei/mount_jia3
mount: realpath /Users/jiaxiaolei/mount_jia3: No such file or directory

  1. 磁盘不能被多次挂载。 否则提示 device busy

  2. 电脑接入不同的外部设备或应用,磁盘盘符会不同,每次需要记录一下。

  1. 磁盘在使用,是无法解除挂载。

➜ / sudo umount /dev/disk5s2
umount(/Volumes/Transmit v4.4.6 [K] | CORE): Resource busy -- try 'diskutil unmount'

➜ / sudo diskutil umount /dev/disk5s2
Volume Transmit v4.4.6 [K] | CORE on disk5s2 failed to unmount: dissented by PID 140 (/usr/sbin/securityd)
Dissenter parent PPID 1 (/sbin/launchd)

  1. 重复解除挂载,会提示已经被解除

➜ / sudo diskutil umount /dev/disk2s1
disk2s1 was already unmounted

问题:

jiaxiaoleideMacBook-Pro:~ root# sudo mount -t ntfs -o rw,auto,nobrowse /dev/disk2s2 /Users/jiaxiaolei/mount_jia
mount_ntfs: /dev/disk2s2 on /Users/jiaxiaolei/mount_jia: Read-only file system
mount: /Users/jiaxiaolei/mount_jia failed with 71

扩展阅读

解决Mac连接移动硬盘为只读状态 转载: https://blog.csdn.net/adsl624153/article/details/99094809
https://www.cnblogs.com/testzcy/p/14836943.html

简介:

解决Mac连接移动硬盘为只读状态
1、问题描述
由于移动硬盘默认是NTFS类型,导致连接Mac后,使用访达打开为只读状态。这样就无法进行新增和删除文件的的操作。

2、解决办法
使用命令将移动硬盘的目录重新挂载到当前用户下的目录即可。

记录Device Node

diskutil info /Volumes/???

移出移动硬盘挂载

sudo umount /Volumes/???

将移动硬盘挂载到指定目录

sudo mount -t ntfs -o rw,auto,nobrowse [Device Node] /指定挂载路径

mac 下查看 磁盘信息

➜  /Volumes fdisk -l
fdisk: illegal option -- l
usage: fdisk [-ieu] [-f mbrboot] [-c cyl -h head -s sect] [-S size] [-r] [-a style] disk
    -i: initialize disk with new MBR
    -u: update MBR code, preserve partition table
    -e: edit MBRs on disk interactively
    -f: specify non-standard MBR template
    -chs: specify disk geometry
    -S: specify disk size
    -r: read partition specs from stdin (implies -i)
    -a: auto-partition with the given style
    -d: dump partition table
    -y: don't ask any questions
    -t: test if disk is partitioned
`disk' is of the form /dev/rdisk0.
auto-partition styles:
  boothfs     8Mb boot plus HFS+ root partition (default)
  hfs         Entire disk as one HFS+ partition
  dos         Entire disk as one DOS partition
  raid        Entire disk as one 0xAC partition

mac 下 fdisk -l 等价物:

➜  /Volumes diskutil list
/dev/disk0 (internal, physical):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      GUID_partition_scheme                        *500.3 GB   disk0
   1:                        EFI ⁨EFI⁩                     209.7 MB   disk0s1
   2:                 Apple_APFS ⁨Container disk1⁩         500.1 GB   disk0s2

/dev/disk1 (synthesized):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      APFS Container Scheme -                      +500.1 GB   disk1
                                 Physical Store disk0s2
   1:                APFS Volume ⁨Macintosh HD - 数据⁩     465.2 GB   disk1s1
   2:                APFS Volume ⁨Preboot⁩                 283.2 MB   disk1s2
   3:                APFS Volume ⁨Recovery⁩                622.9 MB   disk1s3
   4:                APFS Volume ⁨VM⁩                      1.1 GB     disk1s4
   5:                APFS Volume ⁨Macintosh HD⁩            22.4 GB    disk1s5
   6:              APFS Snapshot ⁨com.apple.os.update-...⁩ 22.4 GB    disk1s5s1

相关文章

网友评论

      本文标题:解决Mac连接移动硬盘为只读状态 【命令行,不借用第三方nftf

      本文链接:https://www.haomeiwen.com/subject/zjfpzhtx.html