Skip to content

Instantly share code, notes, and snippets.

@jsfaint
Created November 16, 2014 13:13
Show Gist options
  • Save jsfaint/b8b4664136dedeca6064 to your computer and use it in GitHub Desktop.
Save jsfaint/b8b4664136dedeca6064 to your computer and use it in GitHub Desktop.
Enable/Disable Mac build-in NTFS written. e.g.: ./ntfsutil.sh (m/u) /dev/disk2s1
#!/bin/bash
mount_disk()
{
sudo umount $disk
mkdir ~/Desktop/$diskname
sudo mount_ntfs -o rw,auto,nodev,nobrowse,noowners,noatime $disk ~/Desktop/$diskname
echo "Mount $disk to ~/Desktop/$diskname"
open ~/Desktop/$diskname
}
umount_disk()
{
sudo umount $disk
echo "Unmount $disk from ~/Desktop/$diskname"
rmdir ~/Desktop/$diskname
}
#Start from here
if [[ $# -ne 2 ]]; then
echo "$0 m|u /disk/diskXsX"
exit 1
fi
oper=$1
disk=$2
diskname=`basename $disk`
case $oper in
m)
mount_disk
;;
u)
umount_disk
;;
*)
echo "unknown operation"
exit 1
;;
esac
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment