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:
[root@numark ~]# lvs LV VG Attr LSize Origin Snap% Move Log Copy% lv_vm_smtp vg_xen_vms -wi-ao 6.00G lv_vm_smtp_swap vg_xen_vms -wi-ao 512.00M
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
[root@numark ~]# lvcreate -L 80G -n lv_vm_media_backup vg_xen_vms
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:
[root@numark ~]# cat /proc/filesystems | grep hfs
Don't see anything? No sweat, just use one you're comfortable with. From our Dom0, run:
[root@numark ~]# mkfs.ext3 -j /dev/mapper/vg_xen_vms-lv_vm_media_backup
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.
[root@numark ~]# xm block-attach media 'phy:vg_xen_vms/lv_vm_media_backup' sda4 w
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
blkfront: sdaX: barriers enabled
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.
[root@numark ~]# mkdir -p /backup [root@numark ~]# cat /etc/fstab | grep sda4 /dev/sda4 /backup ext3 defaults 0 2
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:
[backup] path = /backup public = yes valid users = user1 user2 writable = yes printable = no create mask = 0644 directory mask = 0755
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.
user1@technics: ~ $ mount_smbfs //user1@media.hq.djragu.com/backup backup/
Next, I ran this command on my Mac in order for Time Machine to recognize the mount.
user1@technics: ~ $ defaults write com.apple.systempreferences TMShowUnsupportedNetworkVolumes 1
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!

