LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (https://www.linuxquestions.org/questions/linux-server-73/)
-   -   how to take backup of complete server (https://www.linuxquestions.org/questions/linux-server-73/how-to-take-backup-of-complete-server-937823/)

centos123 04-03-2012 01:16 AM

how to take backup of complete server
 
hi every one..i need to take complete backup of my linux server in a harddisk and restore back as in previous status.so i can use it in case of emergency..size is near about 500gb.how could i do this.
is any utility or command ...

rodrifra 04-03-2012 02:26 AM

If you want an exact same copy of the whole drive with its partitions AND you can stop that server, you can restart with a USB and make a dd of your hole device (F.I. /dev/sda).

You can use rsync to backup the parts of the drive you are interested on.

If you want a profesional backup system with tape robots and all that stuff you will have to use IBM's TSM or Symantec netbackup (expensive systems, by the way).

centos123 04-03-2012 03:49 AM

i need to take backup entire filesystem.and restore it in fresh machine.so i can use this newly restored server live if my server and DR-server (backup server machine) get damage..how to do it

TenTenths 04-03-2012 04:09 AM

You could rsync to a third machine on a different location, or use something like dirvish. What I've done in the past is to take a full tar backup to tape of the entire filesystem of a server, then in the worst case restore I've installed a bare-bones version of the operating system using the same version and same partition information from my primary and then restored the tape over the top of it. Works fine if you're using identical hardware to restore on to. (We bought a spare system identical to the live systems at the same time)

Ogino 04-03-2012 04:46 AM

If you need to do the full back up of your system into an external hard disk, you can use the tar command as follows.

# tar cvzf /media/your_harddisk/backup.tar.gz /

Where the "your_harddisk" is the label or name of your harddisk.
The command will back up entire filesystems in linux machine creating a gzip type of compression.

To restore;
# tar -xvpf /media/your_harddisk/backup.tar.gz

centos123 04-03-2012 04:51 AM

Quote:

Originally Posted by TenTenths (Post 4643387)
You could rsync to a third machine on a different location, or use something like dirvish.

what did you mean by dirvish...

and if i run rsync -pRvf / root@remote.pc /
does this command will run sucessfully...and what parameter should be used with rsync...

TenTenths 04-03-2012 04:54 AM

Quote:

Originally Posted by centos123 (Post 4643407)
what did you mean by dirvish...

http://www.dirvish.org/

Quote:

Originally Posted by centos123 (Post 4643407)
and if i run rsync -pRvf / root@remote.pc /
does this command will run sucessfully...and what parameter should be used with rsync...

I just normally use rsync -a

Noway2 04-03-2012 05:06 AM

There are lots of how to documents on how to create an image of your hard drive. Most of them discuss how to use netcat and pipe the image over a network. I have found that it is much easier to use a removable storage, such as a USB HDD, especially now that they are available in large sizes at reasonable prices. You can then use DD to make an entire image of the drive and copy it to a file on the removable storage. One of the key pieces of this process is to stop the server and run off of media such as a live CD and be sure to turn swap off so that there is no HDD usage. Stopping all HDD usage gives you the ability to verify the image sum (e.g. md5sum) and verify it against he HDD itself so that you know you have a perfect copy.

centos123 04-03-2012 05:33 AM

Ogino

I want to take backup on external hdd and restore on fresh server.

rodrifra 04-04-2012 01:31 AM

centos123, if you run rsync, avoid /proc and /dev, those directories are recreated everytime you restart the computer, so they are not necessary, besides /proc is changing too often because it contains running processes informacion.

If you can stop the server, I would strongly recommend dd as I stated on my previous post. This way you will have the drive ready to be introduced on any other server and run your old system there (of course if it were a 64bit system the new machine will have to be 64bit).

pantdk 04-04-2012 08:08 AM

Hi

The best backup tool for linux

BSER symantec rhel5.1 to 5.3 (it take complete backup but it slight long)

mondo "open source" rhel 5 to 6 (very simple that make complete os iso & can take at new machine & get whole machine ready)

centos123 04-08-2012 11:04 PM

i had mounted these harddisk on /...
i run rsync but it goes into loop since it is mounted on /...

i had 3 partition now

[root@linuxpc ~]# fdisk -l

Disk /dev/sda: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/sda1 1 60801 488384001 83 Linux

Disk /dev/sdb: 160.0 GB, 160041885696 bytes
255 heads, 63 sectors/track, 19457 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/sdb1 * 1 13 104391 83 Linux
/dev/sdb2 14 19457 156183930 8e Linux LVM


can i do dd command.

centos123 04-08-2012 11:08 PM

@rodifa..
thanks..for informing about proc & /dev as rsync are not able to copy each file of rsync.

can you tell me how do i run dd or rsyc command...above in my previous post mentioned partition of harddisk

centos123 04-09-2012 06:02 AM

i did dd but its failed...
i formatted and installed OS on new hardisk ....and mounted both partition on /mnt /mount dir.

now iam trying to do dd again..lets c results..

rodrifra 04-09-2012 10:10 AM

First of all, you don't have 3 partitions, you have two drives sda and sdb, sda has one partition and sdb has 2 partitions, the second one being a LVM partition.

To use dd you MUST stop the system and restart it with a USB key or a CD, once you have started the system and you don't have (let's assume your / is /dev/sda1) /dev/sda1 mounted as root, you can use dd, just use the next command:

Code:

dd if=/dev/sda of=/dev/the_external_drive
Assuming /dev/sda is the HD you want to backup. If the external drive is formated you can keep the image as a file, instead of copying the partitions and data, in that case, mount /dev/the_external_drive in /mnt and run the next command:

Code:

dd if=/dev/sda of=/mnt/sdaimage.img
Your external drive will contain a file named sdaimage.img containing your full sda drive with partitions.

For an explanation of rsync use man, the command I use to do my backups is

Code:

rsync -aEX --exclude=/dev --exclude=/proc --progress / /dev/yourdevice


All times are GMT -5. The time now is 11:39 AM.