确认U盘相关信息

从下面的显示可以看出,插入的移动硬盘为 /dev/disk2

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

/dev/disk1 (synthesized):
#:                       TYPE NAME                    SIZE       IDENTIFIER
0:      APFS Container Scheme -                      +250.8 GB   disk1
Physical Store disk0s2
1:                APFS Volume ⁨Data⁩                    202.8 GB   disk1s1
2:                APFS Volume ⁨Preboot⁩                 326.5 MB   disk1s2
3:                APFS Volume ⁨Recovery⁩                610.8 MB   disk1s3
4:                APFS Volume ⁨VM⁩                      2.0 GB     disk1s4
5:                APFS Volume ⁨OS⁩                      15.0 GB    disk1s5
6:              APFS Snapshot ⁨com.apple.os.update-...⁩ 15.0 GB    disk1s5s1

/dev/disk2 (external, physical):
#:                       TYPE NAME                    SIZE       IDENTIFIER
0:     FDisk_partition_scheme                        *2.0 TB     disk2
1:               Windows_NTFS ⁨ building studi...⁩ 2.0 TB     disk2s1

卸载移动硬盘的挂载

--- ~ » sudo diskutil unmountDisk /dev/disk2                                                                                                                                 
Unmount of all volumes on disk2 was successful

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

查看下挂载前的目录

--- ~ » df -h
Filesystem       Size   Used  Avail Capacity iused      ifree %iused  Mounted on
/dev/disk1s5s1  234Gi   14Gi   28Gi    34%  567557 2448557803    0%   /
devfs           209Ki  209Ki    0Bi   100%     723          0  100%   /dev
/dev/disk1s4    234Gi  1.8Gi   28Gi     7%       4 2449125356    0%   /System/Volumes/VM
/dev/disk1s2    234Gi  311Mi   28Gi     2%    1130 2449124230    0%   /System/Volumes/Preboot
/dev/disk1s6    234Gi  644Ki   28Gi     1%      16 2449125344    0%   /System/Volumes/Update
/dev/disk1s1    234Gi  189Gi   28Gi    88% 1016640 2448108720    0%   /System/Volumes/Data
map auto_home     0Bi    0Bi    0Bi   100%       0          0  100%   /System/Volumes/Data/home

将移动硬盘挂载到 /Users/zeefeng/mnt/USBDisk目录

--- ~ » sudo ntfs-3g /dev/disk2s1 /Users/zeefeng/mnt/USBDisk

查看挂载结果

从以下显示可以看出,已经成功将移动硬盘挂载到指定目录了

--- ~ » df -h
Filesystem       Size   Used  Avail Capacity iused      ifree %iused  Mounted on
/dev/disk1s5s1  234Gi   14Gi   28Gi    34%  567557 2448557803    0%   /
devfs           246Ki  246Ki    0Bi   100%     851          0  100%   /dev
/dev/disk1s4    234Gi  1.8Gi   28Gi     7%       4 2449125356    0%   /System/Volumes/VM
/dev/disk1s2    234Gi  311Mi   28Gi     2%    1130 2449124230    0%   /System/Volumes/Preboot
/dev/disk1s6    234Gi  644Ki   28Gi     1%      16 2449125344    0%   /System/Volumes/Update
/dev/disk1s1    234Gi  189Gi   28Gi    88% 1016643 2448108717    0%   /System/Volumes/Data
map auto_home     0Bi    0Bi    0Bi   100%       0          0  100%   /System/Volumes/Data/home
/dev/disk2s1    1.8Ti   31Gi  1.8Ti     2%   76071 1920622825    0%   /Users/zeefeng/mnt/USBDisk

将文件复制到指定目录

cp /src/xxx /dest/

由于cp复制是无法显示实时参数的,为了便于了解传输的进度,采用的rsync的方式来复制。

--- ~ » sudo rsync -avPh /Users/zeefeng/Downloads/VMware-VCSA-all-6.7.0-15132721.iso /Users/zeefeng/mnt/USBDisk
building file list ...
1 file to consider
VMware-VCSA-all-6.7.0-15132721.iso
       4.24G 100%   10.84MB/s    0:06:13 (xfer#1, to-check=0/1)

sent 4.24G bytes  received 42 bytes  11.36M bytes/sec
total size is 4.24G  speedup is 1.00

卸载挂载点

--- ~ » sudo umount /Users/zeefeng/mnt/USBDisk
Password:

弹出移动硬盘

--- ~ » diskutil eject /dev/disk2
Disk /dev/disk2 ejected
最后修改:2021 年 01 月 20 日 04 : 31 PM
如果觉得我的文章对你有用,请随意赞赏