# Backup of disk on remote server

## rado3105

It can be done mounting partition as ro, using this command:

dd if=/dev/sda | ssh root@target "(cat >/root/backup.img)"

where /dev/sda is disk on server, target is ip of pc I am trying to do the download from.

Everything works fine, but when I do the backup using that command it makes the backup image of size of hardisk(32gb), but only 4gb are with data. So is any way to backup just that data(something similar to acronis true image)?

----------

## Ant P.

If you only want the data, use rsync.

----------

## rado3105

So its something like copy tool, copies folder. How to restore than server, is possible to copy back that data on running server?(sometimes when I make some experimentation I want to revert back, and I dont want everytime physically do it). Is that possible?

----------

## rado3105

Nobody can help?

----------

## HensonDuglasSturgill

So, I've never actually done this, but I was thinking something like the following command -- assuming you're booted into the Gentoo install CD and have your root (and /boot mounted):

tar -cvj -C /mnt/gentoo --exclude proc --exclude dev --exclude lost+found > /mnt/external/backup.tar.bz2

You'd still need make directories for /dev and /proc when you try to restore, and probably need to run MAKEDEV.

----------

## ppurka

If you are uncomfortable with configuring rsync, then you can use a GUI for rsync like luckybackup.

----------

## bobspencer123

you could check out  stage 4 script  created by blinkeye.

----------

## Hu

 *HensonDuglasSturgill wrote:*   

> So, I've never actually done this, but I was thinking something like the following command -- assuming you're booted into the Gentoo install CD and have your root (and /boot mounted):
> 
> tar -cvj -C /mnt/gentoo --exclude proc --exclude dev --exclude lost+found > /mnt/external/backup.tar.bz2
> 
> You'd still need make directories for /dev and /proc when you try to restore, and probably need to run MAKEDEV.

 Assuming use of the LiveCD, then there is no need to exclude proc and dev.  They are mount points for virtual filesystems, so the on-disk instances directories will not be special when you are in the CD environment.

----------

## TJNII

 *Hu wrote:*   

> Assuming use of the LiveCD, then there is no need to exclude proc and dev.  They are mount points for virtual filesystems, so the on-disk instances directories will not be special when you are in the CD environment.

 

You'll want to exclude proc and sys, otherwise you start picking up things like kernel memory that really bloat your backup.  You can exclude dev if you know what you're doing, but you will need to populate /dev with some files when reassembling the backup if omitted.  I usually use the --one-file-system option with tar and point it at / to exclude dev, proc, sys, NFS mounts, and anything else not on my root disk.

----------

## molot

 *TJNII wrote:*   

> You'll want to exclude proc and sys, otherwise you start picking up things like kernel memory that really bloat your backup.

  Unless, like Hu wrote, computer is running livecd gentoo, and we're backing up the hdd instance. Then proc in context of a backup will have nothing to do with livecd's proc. If any normal files ended there, it might be good to know about them. And backup of a partition that have live, up and running OS on it is hardly ever good idea. Individual directories - yes, but not whole tree.

----------

