LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   remote copy disk (https://www.linuxquestions.org/questions/linux-software-2/remote-copy-disk-665550/)

ust 08-26-2008 11:50 AM

remote copy disk
 
I have a server that have many partition like /var , /usr .... , now I would like to make a copy of this disk ( like diskcopy a: a: in windows ) , including anything in this server ( data & partition etc ) , except plug a harddisk into the server then run diskcopy , can I do it via the network copy ? thx

amani 08-26-2008 12:29 PM

scp can copy recursively. But making a image-copy onto a remote location will require suitable permissions in ssh ...that is all. You can make a image, send it and write it too. A script should do

ust 08-26-2008 12:38 PM

Quote:

Originally Posted by amani (Post 3260481)
scp can copy recursively. But making a image-copy onto a remote location will require suitable permissions in ssh ...that is all. You can make a image, send it and write it too. A script should do

thx reply ,

scp could copy the files but seems can not copy operating system / partition , if I want the destination server is completely the same as the original server , can advise what can i do ? thx

matthewg42 08-26-2008 01:12 PM

You should be able to create an image of a device from a remote machine, provided you have root access to that machine. You would need to un-mount the device, and then scp it's device node to the local machine, like this (example disk is /dev/sdb, which is my USB pendrive):
Code:

localhost% ssh root@remotehost
remotehost# umount /dev/sdb
remotehost# exit
localhost% scp root@remotehost:/dev/sdb remotehost_sdb.img

Presumably, you could then use dd to raw-write that image to a local device of the same size/type.

Playing with images like this is fiddly though. IMO, a better way is just to use a mirroring tool to copy files from the remove device to some local directory. rsync is a tool designed to mirror large number of files between two machines. It is especially good when it comes to updating a previously-made copy, as it will intelligently choose which files to copy, and with large files will only copy parts of files which have been modified.

ust 08-26-2008 06:36 PM

Quote:

Originally Posted by matthewg42 (Post 3260520)
You should be able to create an image of a device from a remote machine, provided you have root access to that machine. You would need to un-mount the device, and then scp it's device node to the local machine, like this (example disk is /dev/sdb, which is my USB pendrive):
Code:

localhost% ssh root@remotehost
remotehost# umount /dev/sdb
remotehost# exit
localhost% scp root@remotehost:/dev/sdb remotehost_sdb.img

Presumably, you could then use dd to raw-write that image to a local device of the same size/type.

Playing with images like this is fiddly though. IMO, a better way is just to use a mirroring tool to copy files from the remove device to some local directory. rsync is a tool designed to mirror large number of files between two machines. It is especially good when it comes to updating a previously-made copy, as it will intelligently choose which files to copy, and with large files will only copy parts of files which have been modified.


thx reply ,

for your umount method , I must do it at same size harddisk / partitiion ? if yes , how can I do it when the size is different ? why need umount , I can't copy it when it is mount ?

matthewg42 08-26-2008 06:51 PM

Quote:

Originally Posted by ust (Post 3260791)
thx reply ,

for your umount method , I must do it at same size harddisk / partitiion ? if yes , how can I do it when the size is different ? why need umount , I can't copy it when it is mount ?

Yes, I think you do need a device of similar size. I think you can use a larger device as the destination if you like, but some of the space will be wasted.

I imagine it is necessary to un-mount a device before imaging it because a mounted drive which is simply powered off without un-mounting has to go through some sort of recovery process, and I guess the same thing would happen with an image if you did not un-mount the device first, with some risk of data loss.


All times are GMT -5. The time now is 06:52 AM.