To mount a hard drive on a custom mountpoint:
You can do this with diskutil mount
and the -mountPoint
option.
From the man page:
mount [readOnly] [-mountPoint path] device
Mount a single volume. If readOnly is specified, then the file system is mounted read-only, even if the volume's underlying file
system and/or device and/or media supports writing; even the
super-user may not write to it; this is the same as the rdonly option
to mount (8). If a -mountPoint is specified, then that path, rather
than the standard path of /Volumes/VolumeName, will be used as the
view into the volume file con- tent; a directory at that path must
already exist.
From man diskutil
, section 'Verbs'.
The syntax to mount to a custom mountpoint is as follows:
diskutil mount -mountPoint /path/to/custom/mountpoint [volume (identifier/UUID/label)]
Bear in mind that /path/to/custom/mountpoint
must be a
directory, just like with mount
, and that your
identifier/UUID/label are specific to the volume (i.e. /dev/diskXsY
not /dev/diskX
). Mounting to a custom mountpoint cannot be done with
diskutil mountDisk
, and only works with a single volume at a time.
From my answer to How to mount disk by UUID or LABEL in OS X El Capitan.
I've tested this by "mounting" a USB stick on an external hard drive. As an example,
$ 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_HFS Macintosh SSD 499.4 GB disk0s2
3: Apple_Boot Recovery HD 650.0 MB disk0s3
/dev/disk1 (external, physical):
#: TYPE NAME SIZE IDENTIFIER
0: GUID_partition_scheme *1.0 TB disk1
1: EFI EFI 209.7 MB disk1s1
2: Apple_HFS HDD-1T 999.8 GB disk1s2
/dev/disk2 (external, physical):
#: TYPE NAME SIZE IDENTIFIER
0: FDisk_partition_scheme *31.6 GB disk2
1: Windows_NTFS USB-32 31.6 GB disk2s1
As you can see, /dev/disk2s1
, or USB-32
is the name of the USB stick I am going to mount on the hard drive, /dev/disk1s2
, or HDD-1T
. To do so, make use of the -mountPoint
option. But first, make sure there is a landing directory to mount onto:
$ mkdir /Volumes/HDD-1T/mountpoint
And now, to mount:
$ diskutil mount -mountPoint /Volumes/HDD-1T/mountpoint /dev/disk1s2
The mounted disk will appear in the following locations: /Volumes
, and /Volumes/HDD-1T/mountpoint
as USB-32
and mountpoint
respectively.
Be sure to unmount (diskutil umount
) your USB-32
equivalent before remounting on your HDD-1T
equivalent.
Restoring from a snapshot happens when you run the migration assistant or boot to recovery HD / internet recovery.
Follow the restore steps from:
The tmutil restore
command is targeted at one or several individual file copies from my interpretation of the manual page and using it in practice. It works well for "go get this file" or "go get this folder" from that specific backup and not to much for rolling back a checkpoint of the whole system or a large volume of files.
Best Answer
I think your conclusion is wrong - even if it looks that way superficially, the snapshot is actually not changed.
The thing that tricks you here is your one of the folders in your path is actually a link. If you're running on pre-Catalina macOS version, you probably have /Users as a symbolic link. If you're running on Catalina, /Users is a firmlink.
This means that when you run
ls /private/tmp/snap/Users/dmd/foo
to check for the file, you're actually not looking at a file inside the snapshot, but rather the system will traverse the link inside the snapshot and onto your ordinary volume for the actual file.If you're on Catalina and want to redo your commands without the link interferring with you, you will need to instead use the following command to check for existence of the file inside the snapshot: