How to create a copy of whole server into a image?

2

I have a physical server which has some mission critical data on it and some other hosted application. The server needs to be taken down and data needs to be migrated at some place eles. What i want to do is basically create a copy of the whole system into a image or something which i will be able to mount at a local rack.

The server is a Linux 14.04, and i use SSH to access it. What exactly is the way to do so? i looked into something like How to create VHD disk image from a Linux live system? , is this the proper way ? I am not sure since i am looking to get the image as the end result which will be mountable to another physical server.

The output of fdisk -l

Disk /dev/sda: 21.5 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders, total 41943040 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000ccc84

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *        2048      499711      248832   83  Linux
/dev/sda2          501758    41940991    20719617    5  Extended
/dev/sda5          501760    41940991    20719616   8e  Linux LVM

Disk /dev/sdb: 107.4 GB, 107374182400 bytes
43 heads, 44 sectors/track, 110843 cylinders, total 209715200 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00347e2d

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1            2048   209715199   104856576   83  Linux

Disk /dev/sdc: 85.9 GB, 85899345920 bytes
255 heads, 63 sectors/track, 10443 cylinders, total 167772160 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

Disk /dev/sdc doesn't contain a valid partition table

Disk /dev/mapper/bel1psvr01-root: 103.8 GB, 103825801216 bytes
255 heads, 63 sectors/track, 12622 cylinders, total 202784768 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

Disk /dev/mapper/belpsvr01-root doesn't contain a valid partition table

Disk /dev/mapper/belpsvr01-swap_1: 1069 MB, 1069547520 bytes
255 heads, 63 sectors/track, 130 cylinders, total 2088960 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

Disk /dev/mapper/belpsvr01-swap_1 doesn't contain a valid partition table

Nishant Singh

Posted 2016-05-27T06:11:26.120

Reputation: 131

How is the server partitioned? Do you need all the partitions? – Paul – 2016-05-27T06:14:00.383

i just updated the question , and yes i need EVERYTHING – Nishant Singh – 2016-05-27T06:36:43.587

have a look at http://relax-and-recover.org/ There is no "magic" tool in lunix that do a full bootable backup (like AIX's mksysb or HP-UX's ignite).

– Archemar – 2016-05-27T09:19:20.253

Answers

3

It depends on what exactly you are trying to accomplish.

1. Are you trying just to copy all of your files somewhere else? Then you just need the following command,

/usr/bin/rsync -a  --delete --ignore-errors / you@Home:/The/Path/to/where/you/want/to_store/your_data/ --exclude={tmp/*,proc/*,sys/*} --inplace --no-whole-file --log-file=$LOG   

issued on the machine you wish to backup. Some options (delete, inplace, no-whole-file) are useful only if you need to do this several times. Files in /tmp, /proc, /sys/ are excluded because they reside in memory, and they would be lost anyway.

2. Do you need instead a copy of the whole disk, including boot sector and so on? This may be more complex, given that you only have ssh access to this machine, but, by the look of it, it appears you are trying to make a copy of a Virtual Machine. The easiest thing is then to ask your service provider (the person from whom you are renting the VM) to provide you with an OVA image of your VM.

Once you have the OVA, you can easily import it to any Hypervisor.

Or, if you want to install on bare metal, or burn to USB/CD, keep in mind that the OVA file contains a copy of all your disks, in vmdk format. You may extract the disk from the OVA file (which by the way is just a tar file of a directory containing, among other things, the vmdk file you are searching for), then convert it to an iso image with the following VirtualBox command (you need one Hypervisor installed somewhere, of course, the following is for VirtualBox):

VBoxManage clonemedium file.vmdk file.iso --format RAW

The resulting iso image can then be burned to a cd or to a usb, as needed.

MariusMatutiae

Posted 2016-05-27T06:11:26.120

Reputation: 41 321