Table of Contents
When using a server or a remote connection, it is not guaranteed that a device will be made available automatically; therefore, how can we Mount and Unmount Drives from command line on mac? Typically, unmounting external drives on a Mac is accomplished quickly and easily by dragging the drive icon to the trash or by clicking the eject icon in the Finder window. Typically, when a new drive is inserted into a USB Flash drive or SD card slot, mounting occurs automatically.
This tutorial examines various methods for mounting and unmounting discs and disc images. We will employ a variety of methods and tools, including terminal emulator commands and graphical user interface (GUI) tools.
Steps To Mount and Unmount Drives from command line on mac
Find the Drive to Mount
If you already know the location of the volume, you can skip part 1 and proceed directly to part 2, but let’s cover retrieving the volume identifier anyway. This time, we’ll only need to locate the identifier because we’ll assume we already know the drive’s name. This will be accomplished by using grep to condense the output of the diskitis command:
$ diskutil list |grep OSXDaily
2: Apple_HFS OSXDaily 15.7 GB disk1s
Mount (or Remount) the Drive
- To mount (or remount) a drive, we’ll use the same diskutil command with a new flag and inputs like so:
- diskutil mount /dev/disk1s2
- Using the same examples as elsewhere, here is what the command and the output will look like:
- $ diskutil mount /dev/disk1s2
- Volume OSXDaily on /dev/disk1s2 mounted
- This obviously mounts the drive again, and it will also make the mounted volume visible again in the Mac OS X Finder and to GUI-based apps in the various Open or Save dialog boxes.
FAQ
How do I unmount a drive in Mac command line?
Enter the following command once more using the terminal application: sudo diskutil unmount force /dev/ (enter here disc identifier name) Then press return and, if prompted, enter the administrator password. This will unmount the entire disc and all volumes associated with it.
How do I force a drive to mount in Mac Terminal?
- Connect the drive to your Mac.
- Open Disk Utility on your computer (go to Finder > Applications > Utilities and click Disk Utility to open it).
- Select your external HDD on the sidebar on the left.
- Click the Mount button at the top.