Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Mount and unmount external drives easily via AppleScript Storage Devices
I like to eject my external drives because they slow down my mac when they spin up, but I want to have an easy way to access them if I need to. I wrote a little AppleScript that will toggle the mount status of the drive (if it's mounted, it will eject, if it's unmounted, it will mount).

To run the script, use the script menu at the right of the menu bar, or bind it to a hot key using a Quicksilver-type app. Be sure to change 'YourDiskNameHere' to the name of the volume you're working with.

The script can be easily adapted to only eject, or only mount the drive. You can also tweak it to display a Mount/Unmount dialog if you wish.
set diskName to "YourDiskNameHere"
tell application "Finder"
 if disk diskName exists then
  eject disk diskName
 else
  tell current application
   set deviceLine to (do shell script "diskutil list | grep \"" & diskName & "\" | awk '{ print $NF }' }'")
   if deviceLine = "" then
    display dialog "The disk \"" & diskName & "\" cannot be found." buttons {"OK"} default button 1 with title "Error" with icon caution
   end if
   set foundDisks to paragraphs of deviceLine
   repeat with i from 1 to number of items in foundDisks
    set this_item to item i of foundDisks
    if this_item contains "disk" then
     do shell script "diskutil mountDisk /dev/" & this_item
    end if
   end repeat
  end tell
 end if
end tell


[crarko adds: Seems to work fine.

Note: A minor correction to the script was made per request of the author, based on a simplification given in a comment below.]
  Post a comment  •  Comments (19)  
  • Currently 3.56 / 5
  You rated: 1 / 5 (9 votes cast)
 
[32,593 views] Email Article To a Friend View Printable Version
Easy way to 'trim' an SSD Storage Devices
It looks like a simple Disk Repair will trim an SSD.

I got a new SSD and so I booted from a tertiary drive to clone my old SSD onto my new SSD. After the clone I ran Repair Disk and noticed at the end of the repair it "trimmed" my SSD. Maybe I just missed this before, but I don't recall seeing this trim line in repair disk before.
Verify and Repair volume "newsystem"
Checking Journaled HFS Plus volume.
Checking extents overflow file.
Checking catalog file.
Checking multi-linked files.
Checking catalog hierarchy.
Checking extended attributes file.
Checking volume bitmap.
Checking volume information.
Trimming unused blocks.
The volume newsystem appears to be OK.
Volume repair complete.Updating boot support partitions for the volume as required.
So, to force a trim just boot from another drive and run repair disk on the SSD. Disclaimer, I have the third party Trim Enabler tool/hack installed.

[crarko adds: This is another one of those things I don't have the hardware to test. Trimming an SSD is a way of optimizing the read/write/modify process for the device. It's a bit analogous to defragmenting a hard drive.]
  Post a comment  •  Comments (16)  
  • Currently 3.60 / 5
  You rated: 3 / 5 (5 votes cast)
 
[17,015 views] Email Article To a Friend View Printable Version
Apparent fix for SD cards repeatedly unmounting, remounting Storage Devices
I had a problem with my MacBook Pro repeatedly unmounting and remounting SD cards.

Fixing permissions and restarting didn't help.

Rebooting once into Safe Mode (shut down, power up and press and hold Shift after the chime) fixed it.

Just in case anyone out there runs into the same problem, they can find the solution here. I couldn't find anything on the Internet that referred to this issue.

[crarko adds: This would likely indicate that there was some incompatible driver cached. Booting in Safe Mode probably forced the cache to be rebuilt, eliminating the conflict. I've seen this kind of thing with drivers before, but not for a long time, maybe in Tiger.]
  Post a comment  •  Comments (1)  
  • Currently 3.00 / 5
  You rated: 5 / 5 (4 votes cast)
 
[4,565 views] Email Article To a Friend View Printable Version
Checking Very Large Time Machine Volumes Storage Devices
Checking very large disk volumes with Disk Utility, especially Time Machine backup disks, can be painfully slow, taking many hours to complete, if it completes at all. This Terminal script vastly speeds up checking big volumes.

The tool behind Disk Utility's volume checking is fsck_hfs, which can also be run from the command line. The key to fast volume checking is a sufficiently large cache for the volume structures in memory, which Disk Utility obviously doesn't supply. This example uses 2.2 GB cache in RAM:

sudo fsck_hfs -f -c 2200m /dev/disk2

For a full 1TB Time Machine backup disk with many millions of files, this completes in about 10 minutes. A nice side effect is that this also puts less stress on the disk, as most reads are served from the cache.

Adding the little shell script below to your command line tools can make your life a lot easier. It takes the volume name as the single argument. The drive is unmounted during the check and remounted when finished.
#!/bin/bash
# Run a fast volume check on large Time Machine backup disks
export VOLUME=/Volumes/$1
echo "Determining disk device of $VOLUME"
export DISK=`diskutil info $VOLUME | sed -n '/ Device Node\:/s/.* \(\/dev\/disk.*\).*/\1/p'`
if [ "$DISK" = "" ]; then
  echo "Unable to determine device name!"
  exit 1
fi
echo "Performing filesystem check on $DISK"
diskutil unmountDisk $DISK
sudo fsck_hfs -f -c 2200m $DISK
diskutil mountDisk $DISK
I hope this will be useful for you.

[crarko adds: I haven't tried this, but the script looks sound.]
  Post a comment  •  Comments (24)  
  • Currently 4.45 / 5
  You rated: 4 / 5 (11 votes cast)
 
[13,678 views] Email Article To a Friend View Printable Version
Re-using your Macbook Air 10.6 recovery USB drive Storage Devices
With the arrival of Lion, you might be stuck with a recovery USB drive that came with your Snow Leopard pre-installed Macbook Air. Seeing as these are slick little gadgets, it might be nice to use them for other purposes. After all, it's an 8 Gb flash drive just sitting there. Here's how.

Firstly one needs to remove the lock used by Apple. To do this, download sm32xtest (no need to look, Google has already found it) and open in Windows, for example through Boot Camp or on another PC. When you plug in the flash drive it will appear in the first line of the program. Hit 'start' and wait for the program to flash a big green OK.

Now you're ready to use Disk Utility. In Disk Utility, you'll see the flash drive mounted as 8.02Gb, so erase it and re-partition to your liking.

Thanks to many other posters on other fora; I found this, I didn't invent it.

[crarko adds: Try this at your own risk, although I suppose there isn't much to lose by it. Exercise whatever usual cautions you have in running Windows software.]
  Post a comment  •  Comments (10)  
  • Currently 2.75 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (4 votes cast)
 
[13,557 views] Email Article To a Friend View Printable Version
Maintaining a Dynamic DNS automatically. Storage Devices
Dynamic DNS services provide you with a domain name you can use with a non-static IP address, like most home computers have. To use these requires some action to periodically contact the DNS server and let it know if your Dynamic IP address changed. Usually there are complicated scripts provided to do this, and MacOSXHints has published a few.

However one can greatly simplify this with a launchDaemon and a single built in OSX unix command.

First, this assumes that you have set up an account with a Dynamic DNS service. I use the free service provided by FreeDNS. One updates this simply by loading a web page URL. The act of making that page request alerts the DynamicDNS of your IP address and it updates.

Thus all we need is a LaunchDaemon that runs every hour that reloads that page. Here is an example:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
	<key>Label</key>
	<string>dynamic_dns_updater</string>
	<key>Disabled</key>
	<false/>
 <key>UserName</key>
 <string>nobody</string>
	<key>StartInterval</key>
		<integer>3600</integer>
	<key>ProgramArguments</key>
	<array>
		<string>/usr/bin/curl</string>
		<string>--silent</string>
		<string>--insecure</string>
		<string>https://freedns.afraid.org/dynamic/update.php?YKIJUSiikf83kfj8dhfhuee9jdjd9ejfj99fj9jslRRRT</string>
	</array>
</dict>
</plist>
You will need to edit the above example an insert the key for your registered dynamic DNS account in the above string GET request. The one above is not for your site. You can find this at FreeDNS by simply manually refreshing your site online and then looking at the URL that it used. Other dynamicDNS services will have other URL structures that you need to query for the update.

You save this in the location:

/Library/LaunchDaemons/dynamic_dns_updater.plist

then load it:
sudo launchctl load /Library/LaunchDaemons/dynamic_dns_updater.plist
sudo launchctl start dynamic_dns_updater
And that's it. This will perpetually update your dynamic DNS whenever the computer is awake.

To remove it permanently:
sudo launchctl stop dynamic_dns_updater
sudo launchctl unload /Library/LaunchDaemons/dynamic_dns_updater.plist
rm /Library/LaunchDaemons/dynamic_dns_updater.plist
A few caveats on getting this to work. First, if you just download that plist file above, depending on how you do this, you may end up with some unwanted extended file attributes. The launch Daemon service won't run files with the wrong permissions or attributes. You can inspect these by listing the file like this:

ls -laeo@ /Library/LaunchDaemons/

if you see any below the file you can then manually delete these with the xattr command. For example, if there is quarantine from the download you can get rid of it like this.
sudo xattr -d com.apple.quarantine /Library/LaunchDaemons/dynamic_dns_update.plist
The plist should be owned by root:wheel.

[crarko adds: I don't use Dynamic DNS, so I haven't tried this. But stepping through the code makes it look safe to try if you do.]
  Post a comment  •  Comments (14)  
  • Currently 4.00 / 5
  You rated: 3 / 5 (5 votes cast)
 
[18,368 views] Email Article To a Friend View Printable Version
Miniguide to fixing Volume-Filesystem errors Storage Devices
There are many drive/filesystem errors that can occur on a Mac. Here are some common symptoms that are indicative of some of them:

Not able to boot the system: You tried to boot. Apple logo appeared, and wheel spun for about 15-20 seconds, then machine turned off. This repeated every time you tried to boot the system. (REASON: The system does not find your HD and thus the OS to boot).

Everything seems to work fine till your system hangs briefly and in an unpredictable way. You wait for a while, and the system magically comes back to normal. But after another while, the same thing re-occurs! (This cycle repeats in the current session).

You can do these simple things to check for other possible causes:
  • Run Activity Monitor to see that this is NOT due to temporarily high CPU and/or Memory usage.
  • Check the system log using Console.app or running tail -f /var/log/system.log in Terminal. If your system is having some I/O error then it is sure that there is an HD failure issue.
I don't claim to be an expert on this subject matter, just an (over)enthusiast Mac user. This guide is purely based on my personal experience and is bound to contain errors. So, USE IT AT YOUR OWN RISK! [crarko adds: Consider this hint to also serve as a reminder to check your backups...]
read more (1,171 words)   Post a comment  •  Comments (6)  
  • Currently 1.53 / 5
  You rated: 1 / 5 (15 votes cast)
 
[63,495 views] Email Article To a Friend View Printable Version
Make a dual-partitioned HFS+/FAT32 drive play nice with Windows Storage Devices
This may be evident to some people, but I was a little surprised that my first attempt at it failed.

If you ever want to divide a drive into two partitions, one formatted as Mac OS Extended (HFS+) and the other as FAT32, and to be able to access the FAT32 partition from Mac OS X and Windows, just make sure you set the FAT32 partition as the first one on the drive when you partition it with Disk Utility.

To be able to use it under Windows, you also have to make sure the partitioning scheme is set to Master Boot Record (MBR).

If you set the HFS+ partition as the first one, Windows won't be able to see the FAT32 partition and will tell you that the disk has to be formatted.

I tested this with a USB flash drive under Windows 7 Pro and under XP Pro, and both only recognized the FAT32 volume when it was the first one.

I did not test this with a hard drive, with a different bus than USB, or under Windows Vista, but I assume these cases follow the same behavior.

[crarko adds: We've run previous hints about setting up multi-filesystem external hard drives, but the procedure here is quite a bit simpler. Obviously if you want to use this to transfer files to either type of system you'll want to copy things to the FAT32 partition, unless you have HFS+ drivers for your PC or use HFSExplorer in Windows.]
  Post a comment  •  Comments (7)  
  • Currently 3.50 / 5
  You rated: 3 / 5 (6 votes cast)
 
[32,313 views] Email Article To a Friend View Printable Version
Fix SSD slow boot times Storage Devices
If you've just upgraded from a disk drive to a solid-state disk, booting from reset should take about 15 seconds, logging in should take about 5 seconds, and applications should launch about three to five times faster. However, you may find that everything is faster except the boot from reset, with the initial Apple logo not appearing for about 30 seconds.

The fix is to go into System Preferences » Startup Disk and select your new solid-state drive. This prevents a 30-second timeout before the boot starts.

Upgrading to a SSD is easy, if a bit expensive. I'd suggest turning your brand-new SSD into a temporary external USB drive using a Universal HDD USB Adapter from Apricorn or NewerTech and format it as HFS Extended Journaled, 1 partition, with Disk Utility. You can then clone your hard drive to it with Carbon Copy Cloner, making sure you are logged in as a administrative user who does *not* have FileVault enabled. Then open up the Mac (using instructions from iFixit.com) and swap the two drives. Set the startup drive and you're done.

[crarko adds: I haven't tested this one. Obviously when you connect a new boot device you should be sure it is selected as your Startup Disk, or the system will experience a delay while it searches for a bootable System, sometimes including a network boot device which can take a while until it times out.]
  Post a comment  •  Comments (15)  
  • Currently 3.45 / 5
  You rated: 3 / 5 (11 votes cast)
 
[34,167 views] Email Article To a Friend View Printable Version
Extra photo and video storage for iPad Storage Devices
This hint requires the Apple Camera Connection Kit and some SD cards.

You may find it useful for all sorts of reasons to have extra storage space available on your iPad. In my case as a regular traveller I like to take a number of movies to watch on my iPad but there is a limit to how many large-sized films that can be stored on the device; especially if you have one of the smaller memory sized ones. I know apps like AirVideo can stream from your home computer even when travelling away from home, but this is not always practical depending on where you go.

I have discovered, after reading a hard-to-find hint elsewhere on the web, that photos and videos can be stored on an SD card, and imported with the SD card adapter in the Camera Connection Kit, as long as the filenames are in a recognised format. The original hint I found suggested that just naming the files correctly would work but I found that the files need to be in a specific folder to be recognised.

The SD card you use needs to have the folder structure that is created when the card is used in a camera, so I just used a card that already contained this structure, but one where all the old photos/videos have been removed.

The folder structure on my card looks like this: DCIM » 100DICAM, but yours may well be different. The important thing is that any movies or photos that you want to be able to import to the iPad need to be in the embedded 100DICAM (in this case) folder. I have another camera where the second folder is not there and on this card I put the movies directly in the DCIM folder.

Than all you need to do is add movies to this folder with the naming structure as used by your camera. An 8 digit name with sequential numbers. Examples could be P0000001, P0000002, etc. or DCM_0001, DCM_0002, etc.

When you then put this card in the Camera Connection Kit and plug it into the iPad, the iPad will ask to import the files. They will be added to the Photos app, but they play just fine from there. I have successfully imported a large HD movie (formatted with Handbrake for the AppleTV). You need a big card for this size of movie though.

With this process you can delete movies from the iPad when they have been watched and add new ones. The only difficulty is that the name structure required means that you don't know what film is what -- a good set of notes would be needed, unless you have a very good memory that is!

[crarko adds: I haven't tested this one.]
  Post a comment  •  Comments (16)  
  • Currently 2.29 / 5
  You rated: 5 / 5 (7 votes cast)
 
[52,929 views] Email Article To a Friend View Printable Version