Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

ad180

macrumors newbie
Original poster
Sep 27, 2014
1
0
I made a big mistake. I ran a script that I found on the Apple Forums on my NTFS-formatted WD MyBook in order to get write access on my Mac Mini. Now I can't view the drive on the Mac Mini or my Windows 7 64bit Sony Vaio laptop. Windows wants to reformat it.

My Mac Mini is a 2.4 GHz Intel Core 2 Duo with 2 GB of RAM, running Version 10.9.5.

Any advice for retrieving my data? Here's the script:

Code:
#!/bin/bash

checkExisting(){

echo "Checking if already existing device on file..."

while read fileLine; do
    
    if [ "$line" = "$fileLine" ]; then
    	echo "[WARNING] Device already initialized on this system. Nothing to do here"
    	open "$FILENAME"
    	exit 0;
    fi
done < /etc/fstab

}

addLine(){
	uuid=$(diskutil info "$FILENAME" | grep UUID | cut -d ':' -f2 | tr -d ' ')
	volumeName=$(diskutil info "$FILENAME" | grep "Volume Name" | cut -d ':' -f2 | tr -d ' ')
	
	if [ "$uuid" = "" ]; then
		line="LABEL=$volumeName none ntfs rw,auto,nobrowse";
	else
		line="UUID=$uuid none ntfs rw,auto,nobrowse";
	fi

	checkExisting;
	echo "# New NTFS HD: $volumeName on $(date) " >> /etc/fstab
	echo $line >> /etc/fstab
	device=$(diskutil info "$FILENAME" | grep "Device Node" | cut -d ':' -f2 | tr -d ' ')
	diskutil unmount "$FILENAME"
	diskutil mount $device
	open $FILENAME;
	exit 0;
}
checkDisk(){
	filetype=$(diskutil info "$FILENAME" | grep "Type (Bundle):" | cut -d ':' -f2 | tr -d ' ')
	#echo $filetype
	if [ "$filetype" = "ntfs" ]; then
		addLine;
	fi

	if [ "$filetype" = "" ]; then
		echo "Error. Please, select a NTFS device"
	fi
}

#Check sudo
if [[ $(/usr/bin/id -u) -ne 0 ]]; then
    echo "This script should be run as ROOT. Try sudo"
    exit
fi
echo "___________________________________"
echo "RubeniumTB. 2013 --ruben80(at)gmail.com--"
echo ""
echo "Initialize a NTFS Hard Disk on this system to read and write" 
echo "Next time you won't need to initialize it again. Just plug and open but"
echo "take into account that:"
echo ""
echo "* Configured disks will not be auto-opened!!"
echo "* You will need to open /Volumes and click on your disk!!"
echo ""
echo "* Although it should not happen anything wrong, use at your own risk"
echo ""
echo "* IMPORTANT!!. Be sure that the NTFS device has been safely removed or it won't"
echo "be mounted in write mode. In this case you can connect it again to any windows PC," 
echo "remove safely, and then connect to your MAC"
echo ""
echo "* Also IMPORTANT!!. To avoid problems use SHORT names for the Volume names, "
echo "NO SPACES, and preferably only letters/numbers. Of course no special characters!!" 
echo ""
echo "Now you are ready...."
echo "SELECT a NTFS Disk to initialize on this system"
echo "Write quit to exit"
echo ""

select FILENAME in "/Volumes"/*
do
     
     case "$FILENAME" in
        "$QUIT")
          echo "Exiting."
          break
          ;;
        *)
          echo "You picked "$FILENAME" "
          checkDisk;
          ;;
  esac
done
 

TechpumpkinWD

macrumors newbie
Sep 18, 2014
29
3
Hello there,

It seems that something went wrong when messing with the partition on your drive. If Windows wants to format it, it doesn't see a partition at all. I've never had such a problem myself, but I've seen users getting results with partition recovery software in such cases. You might try looking for a good partition recovery tool and try to run it under Windows.

Hope you get it sorted soon.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.