LinuxQuestions.org
Go Job Hunting at the LQ Job Marketplace
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 02-09-2013, 02:08 PM   #1
WiseDraco
Member
 
Registered: Nov 2006
Location: Europe,Latvia,Riga
Distribution: slackware,slax, OS X, exMandriva
Posts: 502

Rep: Reputation: 63
copy whole filesystem via scp ?


Hello!
Today i try to copy a whole filesystem from old server to directory of new with command like scp -r -s -v 192.168.1.1:/ /second/Old_server
but it stops after another time with last lines like copy TtyS ?
i try to copy another ( data_ disk ) with that manner and too have a stop. i think, it try copy directory like a /lost+found and stuck there. it be can copy whole system on scp? if i remember xorrectly, cp -ax have do it, it has some similar for scp? search over google, not see a solution...
 
Old 02-09-2013, 02:19 PM   #2
volkerdi
Slackware Maintainer
 
Registered: Dec 2002
Location: Minnesota
Distribution: Slackware! :-)
Posts: 1,143

Rep: Reputation: 2983Reputation: 2983Reputation: 2983Reputation: 2983Reputation: 2983Reputation: 2983Reputation: 2983Reputation: 2983Reputation: 2983Reputation: 2983Reputation: 2983
The problem is that scp won't handle special files like devices. But something like this will do the trick:

ssh root@192.168.1.1 "(cd / ; tar cf - . )" | (mkdir -p /second/Old_server ; cd /second/Old_server ; tar xvf -)
 
3 members found this post helpful.
Old 02-09-2013, 02:21 PM   #3
WiseDraco
Member
 
Registered: Nov 2006
Location: Europe,Latvia,Riga
Distribution: slackware,slax, OS X, exMandriva
Posts: 502

Original Poster
Rep: Reputation: 63
thanks,ill try it tommorow
P.S. and thanks for the slackware - i use it from 4.0, mainly for routers \ servers, but also a 3-4 years also as only desktop system too some time i use mandriva / mandrake for desktop, but it's "microsoft way" with glucks, and strange things bored me

Last edited by WiseDraco; 02-09-2013 at 02:26 PM.
 
Old 02-09-2013, 05:37 PM   #4
volkerdi
Slackware Maintainer
 
Registered: Dec 2002
Location: Minnesota
Distribution: Slackware! :-)
Posts: 1,143

Rep: Reputation: 2983Reputation: 2983Reputation: 2983Reputation: 2983Reputation: 2983Reputation: 2983Reputation: 2983Reputation: 2983Reputation: 2983Reputation: 2983Reputation: 2983
A quick addendum -- you might have to set umask 000 on the receiving end to avoid filtering perms on /tmp and certain files that might be writable by a group. Here's a fixed command line:

ssh root@192.168.1.1 "(cd / ; tar cf - . )" | (mkdir -p /second/Old_server ; cd /second/Old_server ; umask 000 ; tar xvf -)
 
5 members found this post helpful.
Old 02-10-2013, 03:25 AM   #5
WiseDraco
Member
 
Registered: Nov 2006
Location: Europe,Latvia,Riga
Distribution: slackware,slax, OS X, exMandriva
Posts: 502

Original Poster
Rep: Reputation: 63
Thank you very much! looks like working - in that moment files copying, and some hours continued this state * ~250 Gb )
with your permission, i want to put that command somewhere in slackware docs ( docs.slackware.com), for others, and even me can find this command when it need next time
 
Old 02-10-2013, 03:56 AM   #6
volkerdi
Slackware Maintainer
 
Registered: Dec 2002
Location: Minnesota
Distribution: Slackware! :-)
Posts: 1,143

Rep: Reputation: 2983Reputation: 2983Reputation: 2983Reputation: 2983Reputation: 2983Reputation: 2983Reputation: 2983Reputation: 2983Reputation: 2983Reputation: 2983Reputation: 2983
Quote:
Originally Posted by WiseDraco View Post
Thank you very much! looks like working - in that moment files copying, and some hours continued this state * ~250 Gb )
with your permission, i want to put that command somewhere in slackware docs ( docs.slackware.com), for others, and even me can find this command when it need next time
Absolutely. Be my guest.
 
Old 02-10-2013, 05:03 AM   #7
kikinovak
MLED Founder
 
Registered: Jun 2011
Location: Montpezat (South France)
Distribution: MLED, MLES, CentOS
Posts: 3,062

Rep: Reputation: 1689Reputation: 1689Reputation: 1689Reputation: 1689Reputation: 1689Reputation: 1689Reputation: 1689Reputation: 1689Reputation: 1689Reputation: 1689Reputation: 1689
Quote:
Originally Posted by WiseDraco View Post
Hello!
Today i try to copy a whole filesystem from old server to directory of new with command like scp -r -s -v 192.168.1.1:/ /second/Old_server
but it stops after another time with last lines like copy TtyS ?
i try to copy another ( data_ disk ) with that manner and too have a stop. i think, it try copy directory like a /lost+found and stuck there. it be can copy whole system on scp? if i remember xorrectly, cp -ax have do it, it has some similar for scp? search over google, not see a solution...
I'm not sure if this is exactly what you need, but you might want to have a look at this:

http://sourceforge.net/projects/g4l/

I'm using it in conjunction with a local FTP server. Works great.
 
Old 02-10-2013, 05:15 AM   #8
WiseDraco
Member
 
Registered: Nov 2006
Location: Europe,Latvia,Riga
Distribution: slackware,slax, OS X, exMandriva
Posts: 502

Original Poster
Rep: Reputation: 63
Quote:
Originally Posted by kikinovak View Post
I'm not sure if this is exactly what you need, but you might want to have a look at this:

http://sourceforge.net/projects/g4l/

I'm using it in conjunction with a local FTP server. Works great.
looks, it is not i want in this case. for backup i some years ago in few places used a backuppc solution - very good, imho.
 
Old 05-10-2016, 08:12 AM   #9
WiseDraco
Member
 
Registered: Nov 2006
Location: Europe,Latvia,Riga
Distribution: slackware,slax, OS X, exMandriva
Posts: 502

Original Poster
Rep: Reputation: 63
Hello again!

the script:


ssh root@192.168.1.1 "(cd / ; tar cf - . )" | (mkdir -p /second/Old_server ; cd /second/Old_server ; umask 000 ; tar xvf -)

was great, but today i try to copy whole filesystem from one redhat system to external hdd, and all output stops on that
moment:

tar: ./sys/module/battery/sections/.init.text: File shrank by 4085 bytes; padding with zeros
tar: ./sys/module/battery/sections/.text: File shrank by 4085 bytes; padding with zeros
tar: ./sys/module/battery/refcnt: File shrank by 4094 bytes; padding with zeros
tar: ./sys/module/ac/sections/.strtab: File shrank by 4085 bytes; padding with zeros
tar: ./sys/module/ac/sections/.symtab: File shrank by 4085 bytes; padding with zeros
tar: ./sys/module/ac/sections/.module_sig: File shrank by 4085 bytes; padding with zeros
tar: ./sys/module/ac/sections/.bss: File shrank by 4085 bytes; padding with zeros
tar: ./sys/module/ac/sections/.gnu.linkonce.this_module: File shrank by 4085 bytes; padding with zeros
tar: ./sys/module/ac/sections/.data: File shrank by 4085 bytes; padding with zeros
tar: ./sys/module/ac/sections/__versions: File shrank by 4085 bytes; padding with zeros
tar: ./sys/module/ac/sections/.rodata.str1.1: File shrank by 4085 bytes; padding with zeros
tar: ./sys/module/ac/sections/.exit.text: File shrank by 4085 bytes; padding with zeros
tar: ./sys/module/ac/sections/.init.text: File shrank by 4085 bytes; padding with zeros
tar: ./sys/module/ac/sections/.text: File shrank by 4085 bytes; padding with zeros
tar: ./sys/module/ac/refcnt: File shrank by 4094 bytes; padding with zeros
tar: ./sys/module/uhci_hcd/sections/.strtab: File shrank by 4085 bytes; padding with zeros
tar: ./sys/module/uhci_hcd/sections/.symtab: File shrank by 4085 bytes; padding with zeros
tar: ./sys/module/uhci_hcd/sections/.module_sig: File shrank by 4085 bytes; padding with zeros
tar: ./sys/module/uhci_hcd/sections/.bss: File shrank by 4085 bytes; padding with zeros
tar: ./sys/module/uhci_hcd/sections/.gnu.linkonce.this_module: File shrank by 4085 bytes; padding with zeros
tar: ./sys/module/uhci_hcd/sections/.data: File shrank by 4085 bytes; padding with zeros
tar: ./sys/module/uhci_hcd/sections/__versions: File shrank by 4085 bytes; padding with zeros
tar: ./sys/module/uhci_hcd/sections/.altinstructions: File shrank by 4085 bytes; padding with zeros
tar: ./sys/module/uhci_hcd/sections/.rodata.str1.1: File shrank by 4085 bytes; padding with zeros
tar: ./sys/module/uhci_hcd/sections/__param: File shrank by 4085 bytes; padding with zeros
tar: ./sys/module/uhci_hcd/sections/.rodata: File shrank by 4085 bytes; padding with zeros
tar: ./sys/module/uhci_hcd/sections/.exit.text: File shrank by 4085 bytes; padding with zeros
tar: ./sys/module/uhci_hcd/sections/.init.text: File shrank by 4085 bytes; padding with zeros
tar: ./sys/module/uhci_hcd/sections/.altinstr_replacement: File shrank by 4085 bytes; padding with zeros
tar: ./sys/module/uhci_hcd/sections/.text: File shrank by 4085 bytes; padding with zeros



as we see, it try to copy /sys directory too.

there can be put exclusions for some directory, for it not get copied?
 
Old 05-10-2016, 08:24 AM   #10
Z038
Member
 
Registered: Jan 2006
Distribution: Slackware
Posts: 835

Rep: Reputation: 164Reputation: 164
Look at the --exclude and --exclude-from options of tar.
 
Old 05-10-2016, 10:33 AM   #11
kjhambrick
Member
 
Registered: Jul 2005
Location: Round Rock, TX
Distribution: Slackware-64 -current
Posts: 332

Rep: Reputation: 117Reputation: 117
WiseDraco --

The commands I sent look too dangerous.

I've deleted the content of my post.

I am pretty sure rsync can do what you need. I don't understand your system setup well enough to send a safe command.

-- kjh

Last edited by kjhambrick; 05-10-2016 at 10:49 AM. Reason: Misunderstood original issue.
 
Old 05-11-2016, 06:18 AM   #12
WiseDraco
Member
 
Registered: Nov 2006
Location: Europe,Latvia,Riga
Distribution: slackware,slax, OS X, exMandriva
Posts: 502

Original Poster
Rep: Reputation: 63
Code:
ssh root@11.11.11.11 "(cd / ; tar cf - --exclude=sys --exclude=proc --exclude=dev --exclude=tmp --exclude=run . )" | (cd /mnt/hd/URIGA ; umask 000 ; tar xvf -)
looks like that construction works good.
 
1 members found this post helpful.
Old 05-16-2016, 08:11 AM   #13
jpollard
Senior Member
 
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 4,090

Rep: Reputation: 1064Reputation: 1064Reputation: 1064Reputation: 1064Reputation: 1064Reputation: 1064Reputation: 1064Reputation: 1064
I suggest specifying "--one-file-system" to the "tar cf - ." to prevent it from trying to copy the /dev filesystem (as well as /proc, /tmp if it is a tmpfs, and stick to the goal of "copy a whole filesystem".

Much better than trying to use the exclude options.
 
3 members found this post helpful.
Old 05-16-2016, 10:49 AM   #14
orbea
Member
 
Registered: Feb 2015
Distribution: Slackware64-current
Posts: 382

Rep: Reputation: Disabled
Just use rsync.

https://wiki.archlinux.org/index.php...kup_with_rsync
 
Old 05-16-2016, 07:32 PM   #15
perbh
Member
 
Registered: May 2008
Location: Republic of Texas
Posts: 288

Rep: Reputation: 49
I think there may well be a problem (or two) if you copy a 'live' filesystem with just about any method ...
Several years ago I did a live copy - only to find that the /proc filesystem occupied about 1GB while it is empty for a non-live filesystem. Those were in the days when 1GB was a _lot_ of diskspace. Ever after that - I boot from a usb-stick (or live cd/dvd) and copy the now non-live fs to another medium/partition - ne'er had a problem!
What I used was Alan Cox (anyone remember him?) backup-script which was almost the double of PV's above - ie
Code:
(cd $FROM && tar cf - .) | (cd $TO && tar xvpf -)
Note the 'p'-option - kinda important!!

Last edited by perbh; 05-16-2016 at 07:34 PM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I copy /dev/* from filesystem to filesystem Ulysses_ Linux - Desktop 12 03-09-2011 09:53 PM
Using SCP to copy to local knghtz Linux - Newbie 1 08-19-2009 01:53 PM
scp does not copy to a server??? malo_umoran Slackware 3 11-24-2006 04:13 AM
copy files....using scp help me suguname Mandriva 2 01-26-2005 01:14 AM
copy files....using scp help me suguname Mandriva 5 01-25-2005 05:42 AM


All times are GMT -5. The time now is 04:44 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration