forked from apgsn/ntfs-macos
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit c843bfb
Showing
2 changed files
with
53 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
Script automating NTFS volumes mount in read-write mode for MacOS via MacFUSE and NTFS-3G. Reference: https://github.com/osxfuse/osxfuse/wiki/NTFS-3G | ||
|
||
Before running this script, make sure to install the following packages via Homebrew: | ||
```bash | ||
brew install --cask macfuse | ||
brew install ntfs-3g-mac | ||
``` | ||
|
||
Script execution: | ||
```bash | ||
./ntfs-mount.sh "My Volume Name" | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
#!/bin/bash | ||
|
||
set -e | ||
|
||
# Find volume info | ||
if [[ $# -eq 0 ]] | ||
then | ||
echo "Please provide a volume name as an argument." | ||
exit 1 | ||
fi | ||
|
||
echo "Collecting information on '$1'..." | ||
|
||
info=$(diskutil info "$1") | ||
find_value () { | ||
echo "$info" | grep "$1:" | awk '{ print $NF }' | ||
} | ||
|
||
id=$(find_value "Device Identifier") | ||
mounted=$(find_value "Mounted") | ||
type=$(find_value "File System Personality") | ||
|
||
if [[ "$type" != "NTFS" ]] | ||
then | ||
echo "Cannot mount volume because it's not of type NTFS." | ||
exit 1 | ||
fi | ||
|
||
echo -e "Found id '$id' for volume '$1', mounting..." | ||
|
||
# Unmount if necessary | ||
if [[ "$mounted" == "Yes" ]] | ||
then | ||
sudo diskutil unmount /dev/$id > /dev/null | ||
fi | ||
|
||
# Mount volume | ||
sudo mkdir -p /Volumes/NTFS | ||
sudo /usr/local/bin/ntfs-3g /dev/$id /Volumes/NTFS -o local,allow_other,auto_xattr,auto_cache | ||
|
||
echo "Volume successfully mounted." |