Skip to end of metadata
Go to start of metadata

Overview

The following is a quick how to on getting Mac OS X's Time Machine to use a Samba exported filesystem from a Linux Xen virtual machine.

For my Xen virtual infrastructure, I use LVM for each partition in the virtual machine. By doing so, I am able to add a new partition by using the xm block-attach command to hot add the partition to the machine without any downtime. Each virtual machine is made up of at least 2 partitions (1 for / and 1 for swap) which are just 2 logical volumes. For example, my smtp relay virtual machine is comprised of the 2 logical volumes:

Here, the root partition (sda2) is 6 G and is called lv_vm_smtp, and the swap partition is called lv_vm_smtp_swap.

Adding a new volume to my file server was easy as adding a new logical volume, creating the file system, and hot adding it to the virtual machine. Here's how ...

Create the Logical Volume

Using the same naming convention as above, I create an 80 GB /var parition for the virutal machine 'media', using the volume group vg_xen_vms.

Make the Filesystem

My filesystem of choice is ext3, but you can use just about any. If you have HFS+ support in your kernel, I'd suggest using that since it's the supported Mac OS filesystem. To check if you have support for HFS+, from your DomU run:

Don't see anything? No sweat, just use one you're comfortable with. From our Dom0, run:

Add the Filesystem to the VM

Now you want to hot add the filesystem to the VM. Xen's xm block-attach can do just that.

This will add the logical volume we just created and formatted to the virutal machine called media. The additional options make the partition read / writable (w) and will be seen as sda4. To make sure the device was added properly, run dmesg from the virutal machine. You should see something like

where X is your device number (in my case it was 4).

Mount and Export the new Device

First I created the mount point then added it to /etc/fstab.

Now I wanted to share this volume via Samba since this VM was already running Samba. Some quick tweaks to /etc/samba/smb.conf, and I was up in business:

This is a password protected directory, with only user1 and user2 with access to it. Password authentication is handled via samba, stored in /etc/samba/smbusers and /etc/samba/smbpasswd.

Make Share Available to Time Machine

After I created the Samba share, I mounted it locally to my Mac.

Next, I ran this command on my Mac in order for Time Machine to recognize the mount.

You should now see the volume be listed in your 'Choose Disk' option of Time Machine.

That's pretty much it. Set up your excludes as you normally would then start backing up!

AddThis Social Bookmark Button
Labels: