Skip to content

Posts tagged ‘backup’

29
Jun

Limit Time Machine disk usage on external drives

Time Machine is a very simple and elegant backup solution for Mac OS, with an intuitive restore browser. The problem with Time Machine however, is that it takes up all free disk space before starting to erase old backups. This is no problem if you have a dedicated Time Machine disk, but most people usually want to keep other things on the very same disk.

Time Machine uses different methods for network backup and local backup. One way of limiting remote backups is covered in an earlier article called “Create a fixed size network storage for Time Machine“, so this will instead focus on limiting the disk usage on locally connected disks, such as USB or Firewire.

First make sure that you are using a HFS formatted disk, since we are going to resize the partition. Start Disk Utility and select your external disk from the left menu. Click the Partitions tab and you will be presented with your entire disk. Drag the bottom-right handle of the partition up and make it as small as you want your Time Machine to be. When you are satisfied with the new size, click the plus button at the bottom to add an additional partition to occupy the free space.

Disk Utility

Disk Utility

Now open up the Time Machine preferences and select your disk!

Time Machine Preferences

Time Machine Preferences

The additional volume can be used to store anything you want. Just remember to eject the disk properly before you disconnect it from your Mac!

11
Apr

Safe document writing using Dropbox

dropbox-logoLots of people who write articles or create content in any form, often find themselves generating lots of files. A writer will for instance probably have lots of article drafts laying around. Everyone have different solutions for revision control and backup, ranging from a simple manual file copy to using a full-fledged revision control system such as Subversion.

For everyone else, there is a simple solution for keeping backups of your work in progress, as well as being able to retrieve any previous revision. In addition to all this, it even lets you sync files between multiple computers and access your files online from any computer with internet access.

I guess you know by now that I am talking about Dropbox, a service available for Windows, Mac and Linux. It installs a small application on your computer which monitors a configurable directory for changes and uploads them automatically to the Dropbox servers.

dropbox-revisions

The free version offers 2 GB of space, which should be enough for most people. For photographers and other people dealing with lots of large files, there also a premium option available which gives you 50 GB for $99 per year.

The web interface is beautiful and easy to use for navigating your Dropbox and downloading the files. This is also the place for viewing older revisions for your files and delete, copy, rename and delete them.

dropbox-events

A very handy feature is the ability to share folders with other Dropbox users! If you are working together with other people in a project, just share a folder between you and everyone will instantly have access to all changes in the project folder – automatically.

dropbox-publicThere is even a way of sharing files with non Dropbox users. There is a special folder in the root of the Dropbox named “Public”. Putting files here makes it possible to right-click on the files and copy a public URL for it. To let other people download the file, it’s just a matter of sharing the link with them. They can’t of course make changes to it, nor view its revision history.

Another special folder in the Dropbox root is the Photos folder, which creates instant photo albums for viewing on the web by anyone. This is definitely the easiest way of getting a photo album up on the web, since you only need to copy or move the pictures to this special folder on your computer – Dropbox does the rest.

All iPhone users out there, and possible other phone owners, can access the iPhone web interface too for downloading files in the Dropbox. It is even possible to view the uploaded photo galleries.

dropbox-iphone

There is a tour available on the website which explains all features more in-depth.

Upcoming features include:

  • Timeline based undo
  • Online visualization for any file type
  • An iPhone application/interface that let us download files of interest (pdf, docs, pictures..)
  • Watch any folder support (configurable per host)
  • Better shared folder controls (permissions, etc.)
  • Online edition for text files
  • Add friends
  • Improve Upload Speed
  • Group accounts

If you decide to give Dropbox a go, consider using my referral link when you sign up. That way, both you and I get additional storage for free!

Disclaimer: From this article it may seem like I work for Dropbox, but I don’t. I just like their service a lot!

6
May

Create a fixed size network storage for Time Machine

Time Machine is a backup program built into Mac OS 10.5, Leopard. It saves all files on the computer on a USB  or network drive, which can be used for restoration of individual files or the whole computer.

The normal behavior of Time Machine is to keep

  • hourly backups for the past 24 hours
  • daily backups for the past month
  • weekly backups until your backup disk is full

It is the last point that might cause some trouble for some people, since many people might share the drive with other type of data. There has to be some way to limit the size of the backup volume. This is my approach.

Preparing an image

The first step is to create an image to hold the backup filesystem. If you want this filesystem encrypted, have a look at Mounting encrypted volumes, otherwise just follow the following steps. The image will be created as /ext/timemeachine.img and it will be mounted in /ext/timemachine.mnt.

dd if=/dev/zero of=/ext/timemachine.bin bs=1G seek=250 count=1
losetup /dev/loop1 /ext/timemachine.bin
mkfs.ext3 /dev/loop1
tune2fs -c0 -i0 /dev/loop1
losetup -d /dev/loop1
mkdir /ext/timemachine.mnt

The first thing is to create an image file, and using the dd command we create an empty 250GB file, which will contain the backups. The next step is to setup the image as a loop device, which makes it possible to mount it as usual. loop1 is currently used, but if you know that it is occupied, feel free to choose another device.

The next step is to edit /etc/fstab and add a line which will automatically mount the filesystem when the computer boots.

/ext/timemachine.bin /ext/timemachine.mnt ext3 loop=/dev/loop1 0 0

Then we will mount all filesystems and verify that it has indeed been mounted.

df -h
/ext/timemachine.bin  248G  188M  235G   1% /ext/timemachine.mnt

There should be a line like the above if everything is working correctly. The last step is to set the correct permissions for the directory for your user.

chown -R joch /ext/timemachine.mnt/

Setting up the Samba share

To connect to the server, it is necessary to setup the Samba server. Create a share like the following in /etc/samba/smb.conf.

[tmbup]
comment = Time machine backups
path = /ext/timemachine.mnt
browseable = yes
read only = No
inherit permissions = no
guest ok = no
printable = no

Now just reload Samba and add a user if you have not done so before.

invoke-rc.d samba reload
smbpasswd -a joch

Setting up Time Machine

Connect to the share in Finder as usual.

Finder window

Open up the Time Machine preferences and click Change Disk. It should give you a dialog like this, and Time Machine should then be enabled.

Time Machine setupTime Machine enabled

If you get the error “Time Machine Error: The backup disk image could not be created.”, you will need to do some magic on the server.

Time Machine error

You need to start the backup once again, but this time you will have to be quick and copy the directory it creates on the server. Once Time Machine has finished, the original directory will be deleted, so just copy the saved directory back to the same place.

cp -rp Johnnys\ MacBook\ Pro_001ec2123456.sparsebundle/ ..
# Wait until Time Machine has finished
cp -rp Johnnys\ MacBook\ Pro_001ec2123456.sparsebundle/ timemachine.mnt/

Now run the backup again, and it should complete successfully!

Time Machine run

This behaviour is very strange, but the above trick always solves the problem.

6
Feb

Synchronize your data using Grsync

Keeping your data synchronized with an external data storage is essential to keep your documents and other data secure. Rsync is a robust and popular tool for doing exactly this; so what better tool to use as your personal backup solution.

There are of course other tools for doing this such as Unison, which I wrote about earlier. Which tool you prefer to use for backing up your data is a matter of personal preference, as long as you actually use it. This article will not directly use the rsync tool, but instead discuss the GTK front-end, which gives the user access to the most usable functions and settings.

We will start by installing grsync with your favorite package manager. If you are using a Debian based distribution, just execute apt-get install grsync to get hooked up.

Next, we will initialize a directory with data and a directory to keep the backup. The backup directory should of course be located on an external disk, network drive or something other than the local computer.

$ mkdir -p sync/data sync/backup
$ echo “This is the contents of the first file” > sync/data/one.txt
$ echo “This is also some dummy content” > sync/data/two.txt

The time has now come to start grsync. Start by creating a new session by clicking add and figure out a name to describe your sync pair.

grsync.png

Browse to the source and destination directories to select them. Note that if you are synchronizing to a FAT, NTFS or other type of file-system not supporting Unix permissions, uncheck “preserve permissions”, since those depend on how the partition is mounted, and not the actual permissions.

Before executing the task, it might be wise to run the simulation to see possible problems or just to get reassurance of which files will be copied. When you are ready to start the sync, just press execute and hope for the best.

progress.png

The files should now hopefully be correctly synchronized to the sync/backup directory. You might also notice that the actual command to rsync is displayed on the top. This command could be useful if you want to automate this process using cron or something similar.

To conclude, I have to say that Grsync is a very competent and easy to use tool, suitable for both beginners and more advanced users. The GUI looks polished and usable but will still give you detailed information if you want.