Alvin Poh

Tag: hard drive

How To Find Out What’s Locking Files or Folders in Mac

One of the first problems that I came across the Mac was the “File in use” error that occurred whenever I tried to unmount a hard drive, or unmount a USB thumb drive. It was annoying because I didn’t know how to find the source. In Windows, I would face the same problem too, but I had a program that I used to tell me the offending application. It was handy because it would show me what exactly was locking up my file, and I could unlock/remove its hold.

On the Mac, I had to search for something that offered the same functionality, and I found it in the form of a terminal command:

sudo lsof | grep -i

Basically, the command will look for your filename in the list of open processes, and display all relevant information about it on screen. I find this unwieldy though, so I searched around somemore and found a GUI replacement to this terminal command! It’s called What’s Keeping Me, and it does what the terminal command does, except in a pretty GUI.

whats keeping me screenshot

So now you can find out what’s keeping a file locked on the Mac. Go grab What’s Keeping Me now – it’s donationware, so you can use it for free, and make a donation if you find it useful. Go to the What’s Keeping Me website.

How To Use Rsync on the Mac – A Backup Solution Better Than Time Machine?

After getting my Mac set up properly, I was pretty concerned about getting my backups done. Backups are so crucial (Global Backup Survey), especially since everything’s stored electronically these days. Previously, I used to use FolderClone on Windows, but on the Mac, I wondered what options were available to me.

Time Machine was pretty popular, and came out of the box, but I didn’t like how there wasn’t any control with Time Machine. It was great for normal use, but I wanted to actually make a list of stuff that I wanted backed up, and Time Machine just didn’t have that functionality.

In addition, the space that Time Machine would use would be much greater than I would actually require. So I decided to look for some other backup solution, and I discovered that Macs actually came with rsync!

rsync mac best backup solution

Rsync is a great open-source application that uses delta comparison algorithms to compare files and perform a one-way file copy. You’ll need to actually write the script and run this script via Terminal, but it’s really easy. If you’re not interested in tinkering with command line stuff and scripting, you can actually use a free backup software for the Mac called iBackup, which runs on rsync, but gives you a pretty GUI to manage your backups – what to backup, where to backup, etc.

I highly recommend iBackup. In fact, depending on your needs, I would say that it’s better than cloning your hard drive, because it doesn’t copy over your OS-related files. Meaning you backup your data, and if anything happens, you can just load in a fresh copy of Mac OS, and then restore your data. However if you’re interested in rsync, or wondering how iBackup works, read on!

So rsync uses this format:

rsync -a –progress –delete

The -a flag stands for archive mode, which is just short for the -rlptgoD flag. This tells rsync to transfer only the files/folders that are different/have changed, and to do it recursively, while keeping permissions, ownerships, dates, etc intact.

The –progress flag shows you whatever progress rsync has made, and the –delete flag removes any extraneous files on the destination. This is important because I make loads of changes to my files, sometimes adding and removing files, and I want to be sure that they are removed and not kept on my backup drive.

One thing that stumped me when I ran my backup was that some folders didn’t appear in my backup drive, until I realised that I didn’t watch out for space characters in my filenames. So for instance, if you have any spaces in your filename, you’ll need to put the entire path in single quotes. Make sure you don’t put the ~ character in quotes as well! The ~ (tilde) character is just short for ‘/Users/Alvin/’ in my case. It’ll be your username on your Mac.

I keep all of this in a file named “backup”, and run it every couple of days. To run this, you need Terminal, which is located in Applications/Utilities. Also make sure that you make the “backup” file (you can actually give it any name) runnable by issuing the command:

chmod u+x backup

As an example, here is a portion of my backup script:

rsync -a –progress –delete ‘/Users/Alvin/Music/iTunes/iTunes Music/’ ‘/Volumes/ALVIN_POH/SyncBackup/Music/iTunes/iTunes Music’
rsync -a –progress –delete ‘/Users/Alvin/Pictures/iPhoto Library’ ‘/Volumes/ALVIN_POH/SyncBackup/Pictures/iPhoto Library’
rsync -a –progress –delete ‘/Users/Alvin/Library/Preferences/Yummy FTP/Bookmarks’ ‘/Volumes/ALVIN_POH/SyncBackup/Library/Preferences/Yummy FTP/Bookmarks’
rsync -a –progress –delete ~/Library/Mail/ /Volumes/ALVIN_POH/SyncBackup/Library/Mail

Once you’ve saved your backup script, run it with this command:


Easy peasy, painless, simple Mac backups!

Copyright © 2015 Alvin Poh

Web Hosting by VodienUp ↑