Unix Technical Forum

Selective Copy?

This is a discussion on Selective Copy? within the Gentoo Linux Support forums, part of the Unix Operating Systems category; --> Hey! OK, here's what I'd like to do. I'd like to cp my /usr/portage directory over to another computer ...


Go Back   Unix Technical Forum > Unix Operating Systems > Gentoo Linux Support

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 02-21-2008, 06:23 AM
Xanadu
 
Posts: n/a
Default Selective Copy?

Hey!

OK, here's what I'd like to do.

I'd like to cp my /usr/portage directory over to another computer
(essentially making a snapshot of however current it is at the time).
*HOWEVER*, I don't want to copy over my packages or distfiles dir. The
all the packages there are for a different processor (everything there is
for a Pentium 4, the target machine is a P-MMX), and the distfiles would
waste far too much space to copy the whole thing over (I'm just going to
NFS mount it).

Now I know the easy way is to mv the packages and distfiles out of the
portage dir and copy the remaing stuff to the target machine, but, is
there a way to tell cp to exclude certain directories?

I hope I explained this well enough for someone to make sense of...

Thanx!


Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 02-21-2008, 06:24 AM
Johan Lindquist
 
Posts: n/a
Default Re: Selective Copy?

So anyway, it was like, 09:58 CET Jan 30 2004, you know? Oh, and, yeah,
Xanadu was all like, "Dude,

> Hey!


Yo.

> I'd like to cp my /usr/portage directory over to another computer
> (essentially making a snapshot of however current it is at the
> time). *HOWEVER*, I don't want to copy over my packages or distfiles
> dir. The all the packages there are for a different processor
> (everything there is for a Pentium 4, the target machine is a
> P-MMX), and the distfiles would waste far too much space to copy the
> whole thing over (I'm just going to NFS mount it).


Why don't you just nfs mount /usr/portage as well? Here's what I do, I
have three gentoo boxen which all share the same portage structure.

One of them is a file server, so I found it fitting to appoint it
master and let it export /usr/portage and distfiles to the other
two. /usr/portage is mounted read-only, and the file server rsyncs
on a regular basis by means of cron. The distfiles dir is writeable
from each box (one major catch here, make sure you don't start two
identical emerges at the same time since you'll end up with a b0rked
fetch that way).

If you have packages stored, I think you should probably move the
package dir on each box out of the /usr/portage structure. Look up
"PKGDIR" (and perhaps even "DISTDIR") in /etc/make.conf and see if
that gives you any ideas.

> Now I know the easy way is to mv the packages and distfiles out of
> the portage dir and copy the remaing stuff to the target machine,
> but, is there a way to tell cp to exclude certain directories?


That's not the easy way.

You want to move this to another box, not just copy it to another
place on the original one?

I'd try something like

$ cd /usr
$ tar -cvf - --exclude=distfiles portage | ssh foo "cd /usr && tar -xvf -"

to copy "/usr/portage" to the box "foo" without bringing the
subdirectory "distfiles" along for the ride. Tweak as desired.

hth.

--
Time flies like an arrow, fruit flies like a banana. Perth ---> *
10:02:14 up 5 days, 17:38, 2 users, load average: 2.16, 2.13, 2.10
$ cat /dev/bollocks Registered Linux user #261729
streamline frictionless web-readiness
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 02-21-2008, 06:24 AM
Johan Lindquist
 
Posts: n/a
Default Re: Selective Copy?

So anyway, it was like, 10:19 CET Jan 30 2004, you know? Oh, and, yeah,
I was all like, "Whoa, dude,

> I'd try something like
>
> $ cd /usr
> $ tar -cvf - --exclude=distfiles portage | ssh foo "cd /usr && tar -xvf -"
>
> to copy "/usr/portage" to the box "foo" without bringing the
> subdirectory "distfiles" along for the ride. Tweak as desired.


One tweak might be to correct the use of too many "v" flags. Sorry.

--
Time flies like an arrow, fruit flies like a banana. Perth ---> *
10:34:49 up 5 days, 18:10, 2 users, load average: 2.04, 2.08, 2.07
$ cat /dev/bollocks Registered Linux user #261729
engage interactive markets
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 02-21-2008, 06:24 AM
Ben Measures
 
Posts: n/a
Default Re: Selective Copy?

Johan Lindquist wrote:
> So anyway, it was like, 10:19 CET Jan 30 2004, you know? Oh, and, yeah,
> I was all like, "Whoa, dude,
>
>
>>I'd try something like
>>
>>$ cd /usr
>>$ tar -cvf - --exclude=distfiles portage | ssh foo "cd /usr && tar -xvf -"
>>
>>to copy "/usr/portage" to the box "foo" without bringing the
>>subdirectory "distfiles" along for the ride. Tweak as desired.

>
>
> One tweak might be to correct the use of too many "v" flags. Sorry.
>


Good tip there, I suspected you could do something like that with ssh.
Now I know.

--
Ben M.

----------------
What are Software Patents for?
To protect the small enterprise from bigger companies.

What do Software Patents do?
In its current form, they protect only companies with
big legal departments as they:
a.) Patent everything no matter how general
b.) Sue everybody. Even if the patent can be argued
invalid, small companies can ill-afford the
typical $500k cost of a law-suit (not to mention
years of harassment).

Don't let them take away your right to program
whatever you like. Make a stand on Software Patents
before its too late.

Read about the ongoing battle at http://swpat.ffii.org/
----------------

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 02-21-2008, 06:24 AM
Sybren Stuvel
 
Posts: n/a
Default Re: Selective Copy?

Johan Lindquist enlightened us with:
> One tweak might be to correct the use of too many "v" flags. Sorry.


Another tweak might be the inclusion of the 'z' option for the two tars.
That way, you'll get on the fly compression as well, in case the network
bandwidth is the bottleneck.

Sybren
--
The problem with the world is stupidity. Not saying there should be a
capital punishment for stupidity, but why don't we just take the
safety labels off of everything and let the problem solve itself?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #6 (permalink)  
Old 02-21-2008, 06:24 AM
Johan Lindquist
 
Posts: n/a
Default Re: Selective Copy?

So anyway, it was like, 14:07 CET Jan 30 2004, you know? Oh, and, yeah,
Sybren Stuvel was all like, "Dude,
> Johan Lindquist enlightened us with:


>> One tweak might be to correct the use of too many "v" flags. Sorry.

>
> Another tweak might be the inclusion of the 'z' option for the two
> tars. That way, you'll get on the fly compression as well, in case
> the network bandwidth is the bottleneck.


Would that be redundant, given (or preferable to) ssh compression?
Also, which one is considered faster, bzip (j) or gzip (z)?

In the case of a normal, wired, home user network running 100mbit full
duplex, this is probably academic since it'll be quicker to just skip
compression completely, but now you have me wondering about this.

--
Time flies like an arrow, fruit flies like a banana. Perth ---> *
14:15:44 up 5 days, 21:51, 2 users, load average: 2.05, 2.04, 2.00
$ cat /dev/bollocks Registered Linux user #261729
repurpose B2B interfaces
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #7 (permalink)  
Old 02-21-2008, 06:24 AM
Sybren Stuvel
 
Posts: n/a
Default Re: Selective Copy?

Johan Lindquist enlightened us with:
> Would that be redundant, given (or preferable to) ssh compression?


I'm not sure about which compression ssh uses. If CPU usage isn't an
issue, you can try both ;-)

> Also, which one is considered faster, bzip (j) or gzip (z)?


gzip (de)compresses faster, bzip2 compresses a lot better. Your choise
of compression boils down to the bottleneck question. If your CPU is the
bottleneck, use gzip. Otherwise, use bzip2.

> In the case of a normal, wired, home user network running 100mbit full
> duplex, this is probably academic since it'll be quicker to just skip
> compression completely, but now you have me wondering about this.


Compression can save a lot of time, especially the next time you do this
and you won't have to discuss about it on Usenet ;-)

Sybren
--
The problem with the world is stupidity. Not saying there should be a
capital punishment for stupidity, but why don't we just take the
safety labels off of everything and let the problem solve itself?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #8 (permalink)  
Old 02-21-2008, 06:24 AM
Johan Lindquist
 
Posts: n/a
Default Re: Selective Copy?

So anyway, it was like, 14:37 CET Jan 30 2004, you know? Oh, and, yeah,
Sybren Stuvel was all like, "Dude,
> Johan Lindquist enlightened us with:


>> Would that be redundant, given (or preferable to) ssh compression?

>
> I'm not sure about which compression ssh uses. If CPU usage isn't an
> issue, you can try both ;-)


Well, the entire discussion would be moot if cpu power was infinite,
wouldn't it? The interesting part (to me, anyway) is at which point
compression starts to save time, given different bandwidth and cpu
resources.

A slow computer (at either end) will at some point have a negative
impact on the speed if compression is used, even if bandwidth is
somewhat limited.

>> Also, which one is considered faster, bzip (j) or gzip (z)?

>
> gzip (de)compresses faster, bzip2 compresses a lot better. Your
> choise of compression boils down to the bottleneck question. If your
> CPU is the bottleneck, use gzip. Otherwise, use bzip2.


This is certainly interesting to consider.

>> In the case of a normal, wired, home user network running 100mbit
>> full duplex, this is probably academic since it'll be quicker to
>> just skip compression completely, but now you have me wondering
>> about this.

>
> Compression can save a lot of time, especially the next time you do
> this and you won't have to discuss about it on Usenet ;-)


I'm assuming you mean "experiment", and I think I will.

--
Time flies like an arrow, fruit flies like a banana. Perth ---> *
14:44:49 up 5 days, 22:20, 2 users, load average: 2.00, 2.03, 2.00
$ cat /dev/bollocks Registered Linux user #261729
mesh magnetic architectures
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #9 (permalink)  
Old 02-21-2008, 06:24 AM
Sybren Stuvel
 
Posts: n/a
Default Re: Selective Copy?

Johan Lindquist enlightened us with:
> Well, the entire discussion would be moot if cpu power was infinite,
> wouldn't it?


Yep

I remember the days when I had a 486 with a really slow harddisk. Using
some drive compression util, I was actually speeding up disk access,
because less had to be read/written.

> I'm assuming you mean "experiment", and I think I will.


Good! Only experimentation can give you a definite answer here.

Sybren
--
The problem with the world is stupidity. Not saying there should be a
capital punishment for stupidity, but why don't we just take the
safety labels off of everything and let the problem solve itself?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #10 (permalink)  
Old 02-21-2008, 06:24 AM
Xanadu
 
Posts: n/a
Default Re: Selective Copy?

On Fri, 30 Jan 2004 14:02:54 +0000, Sybren Stuvel wrote:

> Johan Lindquist enlightened us with:
>> Well, the entire discussion would be moot if cpu power was infinite,
>> wouldn't it?

>
> Yep
>
> I remember the days when I had a 486 with a really slow harddisk. Using
> some drive compression util, I was actually speeding up disk access,
> because less had to be read/written.
>
>> I'm assuming you mean "experiment", and I think I will.

>
> Good! Only experimentation can give you a definite answer here.
>
> Sybren


Well, just to jump in here real quick... :-)

It is a "normal" home LAN we're talking about here. 100Mbits Full Duplex.
This machine is very peppy (PIV-2.4GHz, 1G of RIMMs). The target machine
is pretty slow (P200-OD, 96M RAM).

I tried the NFS idea of mounting /usr/portage and that whole thing. I have
problems that I just don't see what's wrong. Here's my Exports on this
box:

/usr/portage/ *(rw,async,no_root_squash)
/usr/portage/distfiles *(rw,async,no_root_squash)

I know, I know that's not very secure, but it's a home LAN that only I
know root's passwd for (that and I'm still learning a lot about NFS...).
distfiles can mount fine remotely, but portage itself gives me a permission
denied error. As you can see, they are being exported exactly the same,
and the dir permissions on them are exactly the same:


drwxr-xr-x 113 root root 4096 Jan 28 08:35 portage

and

drwxr-xr-x 3 root root 106496 Jan 30 07:44 distfiles

Any ideas?




Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 10:30 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com