Take the 2-minute tour ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

The following was posted as an answer to a question of read/write difficulties on NTFS drive which worked perfectly. Thanks Codler. My question is, is there a way for a noob like me to create a shortcut method of running these steps in Terminal instead of typing it in each time I want to mount the drive?

Blockquote

.1. Plug-in your device

.2. Write in Terminal diskutil list and look for IDENTIFIER where TYPE is >Windows_NTFS. In this case it is disk1s1

.3. Then write diskutil unmount /dev/disk1s1

.4. cd /Volumes

.5. mkdir Elements

.6. sudo mount -w -t ntfs -o rw,nobrowse /dev/disk1s1 /Volumes/Elements

.7. open /Volumes/Elements

share|improve this question
add comment

1 Answer 1

You don't want the hard drive to show up in the Finder? I had a similar need in the past, and solved it by adding a line to /etc/fstab:

LABEL=<disk label> <mount point> ntfs auto,nobrowse

where:

  • <mount point> is the directory where you want to mount the hard drive, in your case /Volumes/Elements. I'd recommend, though, that you mount the drive elsewhere to prevent name collisions, as /Volumes is used by the Finder to mount removable drives. Let's say you choose /MyVolumes.

  • <disk label> is the hard drive name as it appears in the Finder, I guess Elements.

So, in your case, the line should read:

LABEL=Elements /MyVolumes/Elements ntfs auto,nobrowse

Now, /etc/fstab is a system file so care must be taken not to break anything:

  1. Open Applications>Utilities>Terminal.

  2. In Terminal, type:

    sudo mkdir -p /MyVolumes/Elements
    

    to create the folder /MyVolumes/Elements.

  3. Now type:

    sudo cp -a /etc/fstab /etc/fstab.bak
    sudo cp /etc/fstab ~/Desktop/fstab.txt
    sudo chown $(whoami) ~/Desktop/fstab.txt
    

    Type your password when asked.

    These commands: 1) create a copy of /etc/fstab you can fallback to if anything goes wrong, 2) copy /etc/fstab to your Desktop, 3) change ownership of the copy on your Desktop so that you can edit it.

  4. Switch to the Finder, double click fstab.txt on your Desktop and add at the bottom of the file (the file is probably empty) the following:

    LABEL=Elements /MyVolumes/Elements ntfs auto,nobrowse
    

    Press S to save the file and Q to close the editor.

  5. Back to Terminal, type:

    sudo mv -f ~/Desktop/fstab.txt /etc/fstab
    

    to overwrite /etc/fstab with your modified version.

  6. Plug in your drive. Does it work? Great! It doesn't? Something went wrong... type in Terminal:

    sudo mv -f /etc/fstab.bak /etc/fstab
    

    to restore the original /etc/fstab.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.