Sunday, January 16, 2011

Backing up Linux server to Windows server?

I need to back up a (virtual) Ubuntu server. The backup media (an external USB disk) is mounted on the Windows (Hyper-V Server) host. The Windows servers on the same host can simply back up using Windows Backup over SMB.

How should I go about backing up the Linux box, given that it'll end up on an NTFS-formatted disk?

Update

I'm not so sure that Samba will work -- it won't preserve symlinks, devnodes, permissions, etc. Similarly, it's not going to preserve filename cases and other odd characters.

I'd like it to be full-fidelity, so that I can use it for disaster-recovery...

  • Installing (and configuring) Samba will allow you to back up the Linux host just like your other Windows servers.

    From Matt
  • You only need the samba client on Ubuntu - most likely this is already installed. Mount the share with:

    sudo mount -t cifs //netbiosname/sharename /media/sharename -o username=winusername,password=winpassword,iocharset=utf8,file_mode=0777,dir_mode=0777
    

    You can then perform your backup using cp, rsync, or your program of choice.

    Alternate: If you can't use samba, you may want to just create a file on the samba filesystem (or directly, since the USB Drive is on the host, you should be able to access it in your VM) then create a "loopback" filesystem on the drive to do your backup.

    dd if=/dev/zero of=/tmp/test-img bs=1024 count=10000000 # 10G filesystem
    mkfs -t ext3 -q /tmp/test-img
    mkdir /mnt/image
    mount –o loop /tmp/test.img /mnt/image
    
  • You're going to use Samba as the transport-I suggest using tar to create the actual backup. Tar will honor the symlinks and store the permissions as well.

    HERE is a good website I use for understanding tar as a backup program

    From Josh Budde
  • If you make a tarball of your data first, and backup the tarball to the cifs mount like described in other answers, you'll preserve symlinks and whatnot.

    From wzzrd

0 comments:

Post a Comment