Hi list,
should it be possible to scp a partition with this command:
scp /dev/sda7 backupserver:/backup/sda7.img
I always get "not a regular file" - which is a clear and understandable error, but my googling tells me that some people are doing this - and it seems to work - at least at their systems.
I know that I can avoid this by simply doing
dd if=/dev/sda7 | ssh backupserver dd of=/backup/sda7.img
So its not a big deal - just curious.
System here is a fully updated CentOS 5.2 x86_64 if that matters
any thoughts?
Henry
henry ritzlmayr wrote:
Hi list,
should it be possible to scp a partition with this command:
scp /dev/sda7 backupserver:/backup/sda7.img
/dev/sda7 is just a file, if you copy it it doesn't mean you'll copy the contents of the partition you'll just copy the block file itself, equivalent to running the mknod command on the other end.
You need to stream the contents of the file to get the data from it, like your dd example.
nate
Am Montag, den 29.09.2008, 09:27 -0700 schrieb nate:
henry ritzlmayr wrote:
Hi list,
should it be possible to scp a partition with this command:
scp /dev/sda7 backupserver:/backup/sda7.img
/dev/sda7 is just a file, if you copy it it doesn't mean you'll copy the contents of the partition you'll just copy the block file itself, equivalent to running the mknod command on the other end.
You need to stream the contents of the file to get the data from it, like your dd example.
nate
Thanks for the answer nate, I get your idea. There are just a few odd things with it.
scp backupserver:/backup/sda7.img /dev/sda7
Works like a charm - meaning it copies the content.
cp /dev/sda7 /backup/sda7.img
Works like a charm as well.
And the research for example:
http://sammoffatt.com.au/knowledge-base-mainmenu/6-daily-linux/9-scp-and-ssh
Describes exactly this procedure - which looks like it works there.
Henry
henry ritzlmayr wrote:
http://sammoffatt.com.au/knowledge-base-mainmenu/6-daily-linux/9-scp-and-ssh
Describes exactly this procedure - which looks like it works there.
hmm strange. I wouldn't expect it to work though I so rarely use scp anymore, rsync is better, and it behaves as I described.
In any case I believe copying directly from the device like that is a bad practice to get into, unless you always plan to have that volume unmounted. You risk considerable data corruption if any data is written to the device while you are reading from it.
nate
Am Montag, den 29.09.2008, 13:48 -0700 schrieb nate:
henry ritzlmayr wrote:
http://sammoffatt.com.au/knowledge-base-mainmenu/6-daily-linux/9-scp-and-ssh
Describes exactly this procedure - which looks like it works there.
hmm strange. I wouldn't expect it to work though I so rarely use scp anymore, rsync is better, and it behaves as I described.
In any case I believe copying directly from the device like that is a bad practice to get into, unless you always plan to have that volume unmounted. You risk considerable data corruption if any data is written to the device while you are reading from it.
nate
/dev/sda7 was just used to keep the example simple. I use this to copy lvm based xen Dom-Us from one system to the other - either for backup or for creating a test environment. I am fully aware that only unmounted, it will be consistent.
Henry
henry ritzlmayr wrote:
Hi list,
should it be possible to scp a partition with this command:
scp /dev/sda7 backupserver:/backup/sda7.img
I always get "not a regular file" - which is a clear and understandable error, but my googling tells me that some people are doing this - and it seems to work - at least at their systems.
i think there are two simple ways to do this :
1> mount /dev/sda7 under say /mnt and scp -r /mnt <destination> 2> and rsync - i think it is most simple and suitable for backup through ssh.
Am Dienstag, den 30.09.2008, 06:25 +0530 schrieb partha chowdhury:
henry ritzlmayr wrote:
Hi list,
should it be possible to scp a partition with this command:
scp /dev/sda7 backupserver:/backup/sda7.img
I always get "not a regular file" - which is a clear and understandable error, but my googling tells me that some people are doing this - and it seems to work - at least at their systems.
i think there are two simple ways to do this :
1> mount /dev/sda7 under say /mnt and scp -r /mnt <destination> 2> and rsync - i think it is most simple and suitable for backup through ssh.
If the content of /dev/sda7 is a filesystem I agree, but if its a raw device (databases, or xen DOM-Us), then this won´t work.
What I am trying to figure out is, why does this work on some (not mine) systems?
Henry