RE: [gentoo-user] How to tar?

2006-03-27 Thread Michael Kintzios


> -Original Message-
> From: Neil Bothwick [mailto:[EMAIL PROTECTED] 
> Sent: 24 March 2006 09:24
> To: gentoo-user@lists.gentoo.org
> Subject: Re: [gentoo-user] How to tar?
[snip...] 
> > Yes, but GNU tar cannot do that, it can only do one command at a 
> > time, either --extract or --delete or ...
> 
> The simplest solution is probably to make several smaller tarballs
> instead on one containing the whole of /usr.

Thanks for all the suggestions.  I ended up breaking up /usr into
smaller directories and I have now migrated the fs onto the laptop.  :-)

However, I tried the --exclude FILE option and could not get it to work.
In particular, I had a go with these:
===
 --exclude /mnt/hda5/portage/*
 --exclude /mnt/hda5/portage
 --exclude portage
 --exclude=/mnt/hda5/portage/*
 . . . etc.
===
I even used ' ' to enclose the path/pattern but I just couldn't get it
to work.  :-(

What did I do wrong?
-- 
Regards,
Mick


-- 
gentoo-user@gentoo.org mailing list



Re: [gentoo-user] How to tar?

2006-03-24 Thread Bo Andresen
On Friday 24 March 2006 15:36, Boyd Stephen Smith Jr. wrote:
> > > Michael Kintzios wrote:
> > > > what I think is needed
> > > > here is untarring of the archive, while untarred data is
> > > > dynamically deleted immediately after untarred to make space for
> > > > more data to be untarred . . . do I make sense?
> > >
> > > Yes, but GNU tar cannot do that, it can only do one command at a
> > > time, either --extract or --delete or ...
> >
> > Yes, that's why I was hoping that some clever bash-ery may be able to
> > pipe the lot together.
>
> Perhaps:
> tar xvf gentoo_usr.tar | while read file; do tar --delete f gentoo_usr.tar
> "$file"; done
>
> That might just screw up your tar file and/or extract junk; I didn't test
> it at all.

ROFL.

No that won't work. ;) You cannot delete while extracting and when extraction 
is completed there is no point. This, however, does work:

tar tf gentoo_usr.tar | sort -r | while read file; do tar -xf gentoo_usr.tar 
"$file" && tar --delete -f gentoo_usr.tar "$file"; done

First of all the dash before f when deleting is necessary. That's just syntax. 
Secondly the sort -r is VERY important to make sure it extracts the deepest 
files (in terms of path) first then deletes them. Both -x and --delete or 
recursive by default.

The problem with this, however, is that it only works with a tar file. 
Apparently it is not possible to delete a file from a compressed tar file.

-- 
Bo Andresen
-- 
gentoo-user@gentoo.org mailing list



Re: [gentoo-user] How to tar?

2006-03-24 Thread Boyd Stephen Smith Jr.
On Friday 24 March 2006 05:53, "Michael Kintzios" 
<[EMAIL PROTECTED]> wrote about 'RE: [gentoo-user] How to tar?':
> -Original Message-
> From: Benno Schulenberg [mailto:[EMAIL PROTECTED]
> > Michael Kintzios wrote:
> > > what I think is needed
> > > here is untarring of the archive, while untarred data is
> > > dynamically deleted immediately after untarred to make space for
> > > more data to be untarred . . . do I make sense?
> >
> > Yes, but GNU tar cannot do that, it can only do one command at a
> > time, either --extract or --delete or ...
>
> Yes, that's why I was hoping that some clever bash-ery may be able to
> pipe the lot together.

Perhaps:
tar xvf gentoo_usr.tar | while read file; do tar --delete f gentoo_usr.tar 
"$file"; done

That might just screw up your tar file and/or extract junk; I didn't test 
it at all.

-- 
"If there's one thing we've established over the years,
it's that the vast majority of our users don't have the slightest
clue what's best for them in terms of package stability."
-- Gentoo Developer Ciaran McCreesh
-- 
gentoo-user@gentoo.org mailing list



RE: [gentoo-user] How to tar?

2006-03-24 Thread Michael Kintzios
Thank you All for your replies.

> -Original Message-
> From: Benno Schulenberg [mailto:[EMAIL PROTECTED] 
> Sent: 23 March 2006 23:42
> To: gentoo-user@lists.gentoo.org
> Subject: Re: [gentoo-user] How to tar?
> 
> 
> Michael Kintzios wrote:
> > As things currently are gentoo_usr.tgz is in /dev/hda2,
> > which is destined to house the /usr/portage directory.  /dev/hda2
> > is a 4.0G partition with only 74M available.
> 
> How big is gentoo_usr.tgz?  What's the rest on /dev/hda2?

gentoo_usr.tgz is 3.9G+ and there's nothing else left in /dev/hda2.
 
> > /dev/hda3 will have the rest of the filesystem 
> > (and the remaining /usr directory).
> 
> What's on /dev/hda3 now?  How big is it?  What's on /dev/hda1?  
> Can't you move the gentoo_usr.tgz to another roomier partition?

There's no other roomier partition which will contain gentoo_usr.tgz as
a single file.

> If I get it right, /dev/hda3 is destined to become your /, 
> and /dev/hda2 your /usr/portage.  Have you already upacked the rest 
> of / on /dev/hda3?  How about retarring it and untarring it after 
> gentoo_usr.tgz?

I'll have a look at doing something like that, although I will not be
able to untar gentoo_usr.tgz into another partition (at 6.4G untarred
there's just not enough space).

> > what I think is needed
> > here is untarring of the archive, while untarred data is
> > dynamically deleted immediately after untarred to make space for
> > more data to be untarred . . . do I make sense?
> 
> Yes, but GNU tar cannot do that, it can only do one command at a 
> time, either --extract or --delete or ...

Yes, that's why I was hoping that some clever bash-ery may be able to
pipe the lot together.

As I have no access to another machine or network until I get back home,
the helpful link provided may have to wait.  Of course once I get back
home I can only tar the directories I need, one at a time.

Thanks again for your replies.
-- 
Regards,
Mick


-- 
gentoo-user@gentoo.org mailing list



Re: [gentoo-user] How to tar?

2006-03-24 Thread Neil Bothwick
On Fri, 24 Mar 2006 00:42:22 +0100, Benno Schulenberg wrote:

> > what I think is needed
> > here is untarring of the archive, while untarred data is
> > dynamically deleted immediately after untarred to make space for
> > more data to be untarred . . . do I make sense?
> 
> Yes, but GNU tar cannot do that, it can only do one command at a 
> time, either --extract or --delete or ...

The simplest solution is probably to make several smaller tarballs
instead on one containing the whole of /usr.


-- 
Neil Bothwick

Shell to DOS... Shell to DOS... DOS, do you copy? Shell to DOS...


signature.asc
Description: PGP signature


Re: [gentoo-user] How to tar?

2006-03-23 Thread Benno Schulenberg
Michael Kintzios wrote:
> As things currently are gentoo_usr.tgz is in /dev/hda2,
> which is destined to house the /usr/portage directory.  /dev/hda2
> is a 4.0G partition with only 74M available.

How big is gentoo_usr.tgz?  What's the rest on /dev/hda2?

> /dev/hda3 will have the rest of the filesystem 
> (and the remaining /usr directory).

What's on /dev/hda3 now?  How big is it?  What's on /dev/hda1?  
Can't you move the gentoo_usr.tgz to another roomier partition?

If I get it right, /dev/hda3 is destined to become your /, 
and /dev/hda2 your /usr/portage.  Have you already upacked the rest 
of / on /dev/hda3?  How about retarring it and untarring it after 
gentoo_usr.tgz?

> what I think is needed
> here is untarring of the archive, while untarred data is
> dynamically deleted immediately after untarred to make space for
> more data to be untarred . . . do I make sense?

Yes, but GNU tar cannot do that, it can only do one command at a 
time, either --extract or --delete or ...

Benno
-- 
gentoo-user@gentoo.org mailing list



Re: [gentoo-user] How to tar?

2006-03-23 Thread Boyd Stephen Smith Jr.
On Thursday 23 March 2006 16:31, Bo Andresen <[EMAIL PROTECTED]> wrote 
about 'Re: [gentoo-user] How to tar?':
> Perhaps that link wasn't as useful to you as I thought when I
> transmitted it. Here are a couple of other examples. I think it requires
> GNU tar.
>
> This compacts data recursively from /from/path and using gzip, pipes it
> through ssh and extracts it into /to/path:
> # tar -zcf - /from/path | ssh desktop.homelinux.com "tar -C /to/path
> -xzf -"

Or, for non-GNU tar:
tar cf - /from/path | gzip -c | ssh desktop.homelinux.com 'cd /to/path; 
gunzip -c | tar xf -'
(Some non-gnu tars probably don't even need the 'f -' parts...)

> And this just pipes through ssh and extracts using bunzip2 to /to/path
> on remote machine
> # cat file.tar.bz2 | ssh desktop.homelinux.com "tar -C /to/path -xjf -"

Or for non-GNU tar without the unnecessarily spawned process:
ssh desktop.homelinux.com 'cd /to/path; bunzip2 -c | tar xf -' < 
file.tar.bz2

(Each of my examples is meant to be a single line.)

-- 
"If there's one thing we've established over the years,
it's that the vast majority of our users don't have the slightest
clue what's best for them in terms of package stability."
-- Gentoo Developer Ciaran McCreesh
-- 
gentoo-user@gentoo.org mailing list



Re: [gentoo-user] How to tar?

2006-03-23 Thread Bo Andresen
On Thursday 23 March 2006 22:52, Bo Andresen wrote:
> On Thursday 23 March 2006 21:24, Michael Kintzios wrote:
> > What should I run to untar the rest of /usr (excluding /usr/portage) into
> > /dev/hda3 and at the same time delete it from within the gentoo_usr.tgz
> > archive, so that I get some space in /dev/hda2 to untar /usr/portage?
> > Really, what I think is needed here is untarring of the archive, while
> > untarred data is dynamically deleted immediately after untarred to make
> > space for more data to be untarred . . . do I make sense?
>
> You don't have to scp the archieve to the machine before unpacking it.
>
> http://gentoo-wiki.com/HOWTO_Backup#Securely_backing_up_a_filesystem_on_a_r
>emote_machine
>

Perhaps that link wasn't as useful to you as I thought when I transmitted it. 
Here are a couple of other examples. I think it requires GNU tar.

This compacts data recursively from /from/path and using gzip, pipes it 
through ssh and extracts it into /to/path:
# tar -zcf - /from/path | ssh desktop.homelinux.com "tar -C /to/path -xzf -"

And this just pipes through ssh and extracts using bunzip2 to /to/path on 
remote machine
# cat file.tar.bz2 | ssh desktop.homelinux.com "tar -C /to/path -xjf -"

-- 
Bo Andresen
-- 
gentoo-user@gentoo.org mailing list



Re: [gentoo-user] How to tar?

2006-03-23 Thread Bo Andresen
On Thursday 23 March 2006 21:24, Michael Kintzios wrote:
> What should I run to untar the rest of /usr (excluding /usr/portage) into
> /dev/hda3 and at the same time delete it from within the gentoo_usr.tgz
> archive, so that I get some space in /dev/hda2 to untar /usr/portage? 
> Really, what I think is needed here is untarring of the archive, while
> untarred data is dynamically deleted immediately after untarred to make
> space for more data to be untarred . . . do I make sense?

You don't have to scp the archieve to the machine before unpacking it.

http://gentoo-wiki.com/HOWTO_Backup#Securely_backing_up_a_filesystem_on_a_remote_machine

Also if you look at man tar you'll find tar --exclude PATTERN

HtH

-- 
Bo Andresen
-- 
gentoo-user@gentoo.org mailing list



Re: Re: [gentoo-user] How to tar?

2006-03-23 Thread Michael Kintzios
> From:: "Michael Crute" <[EMAIL PROTECTED]>
> To: gentoo-user@lists.gentoo.org
> Subject: Re: [gentoo-user] How to tar?
> Date: Thu, 23 Mar 2006 12:32:55 -0500

> In that case I would create /usr on one filesystem and /portage on
> another partition then create /usr/portage and mount /portage to it
> then untar your file. It should look like this:
> 
> /dev/hdx1 (/usr)
> /dev/hdx2 (/portage)
> 
> /usr/portage -> /portage
> 
> Seems to be the most straightforward way of doing it to me.

Cool!  As things currently are gentoo_usr.tgz is in /dev/hda2, which is 
destined to house the /usr/portage directory.  /dev/hda2 is a 4.0G partition 
with only 74M available.  My /usr is more than 3.9G large.  /dev/hda3 will have 
the rest of the filesystem (and the remaining /usr directory).

What should I run to untar the rest of /usr (excluding /usr/portage) into 
/dev/hda3 and at the same time delete it from within the gentoo_usr.tgz 
archive, so that I get some space in /dev/hda2 to untar /usr/portage?  Really, 
what I think is needed here is untarring of the archive, while untarred data is 
dynamically deleted immediately after untarred to make space for more data to 
be untarred . . . do I make sense?
-- 
Regards,
Mick

Lycos iQ - show what you knoW: iq.lycos.co.uk

Re: [gentoo-user] How to tar?

2006-03-23 Thread Michael Crute
On 3/23/06, Michael Kintzios <[EMAIL PROTECTED]> wrote:
> > Hmm... basics... I would start with `man tar` and see where
> > that takes you.
>
> Not very far.  ;-) That's why I'm asking for some quick help.  I also
> need to add that I was seeking answers to the above questions in the
> context of having access only to the new machine and three more
> partitions on it, all of which are smaller than the total uncompressed
> /usr directory.

In that case I would create /usr on one filesystem and /portage on
another partition then create /usr/portage and mount /portage to it
then untar your file. It should look like this:

/dev/hdx1 (/usr)
/dev/hdx2 (/portage)

/usr/portage -> /portage

Seems to be the most straightforward way of doing it to me.

-Mike

--

Michael E. Crute
http://mike.crute.org

It is a mistake to think you can solve any major problems just with potatoes.
--Douglas Adams

-- 
gentoo-user@gentoo.org mailing list



RE: [gentoo-user] How to tar?

2006-03-23 Thread Michael Kintzios


> -Original Message-
> From: Etaoin Shrdlu [mailto:[EMAIL PROTECTED] 
> Sent: 23 March 2006 17:33
> To: gentoo-user@lists.gentoo.org
> Subject: Re: [gentoo-user] How to tar?
> 
> 
> What about doing two separate tar files, one for /usr/portage and the 
> other for the rest of /usr? Then untar each tar file into the 
> appropriate partition.

Thanks, but I won't be able to do that within the space confines of the
partitions available to me on the new machine.  They are all smaller
than the complete uncompressed /usr directory.  To have access to my old
box which has plenty of space to do that, I will have to wait until I
get back home in a couple of days.  I was just looking for a clever way
to do it all in the circumstances described.
-- 
Regards,
Mick


-- 
gentoo-user@gentoo.org mailing list



RE: [gentoo-user] How to tar?

2006-03-23 Thread Michael Kintzios


> -Original Message-
> From: Michael Crute [mailto:[EMAIL PROTECTED] 
> Sent: 23 March 2006 17:03
> To: gentoo-user@lists.gentoo.org
> Subject: Re: [gentoo-user] How to tar?
> 
> 
> On 3/23/06, Michael Kintzios <[EMAIL PROTECTED]> wrote:
> > I think I need to go back to basics here to get out of a hole:
> >
> > I have move my /usr onto a different machine as part of a migration
> > exercise, but the partition in question will barely contain it.  Is
> > there a way of running tar so that:
> >
> > 1. Only part of /usr is untarred in a different partition (all of
> > /usr/*, except /usr/portage which I want to eventually 
> untar it and keep
> > it in there).
> > 2. Those directories which are untarred are also removed 
> from the .tgz
> > file so that there is enough space left behind to untar the 
> /usr/portage
> > directory.
> > 3. Finally, /usr/portage is now untarred into the said 
> partition and the
> >  tgz file is deleted thereafter.
> >
> > Could you please help with the command/piping syntax?
> 
> Hmm... basics... I would start with `man tar` and see where 
> that takes you.

Not very far.  ;-) That's why I'm asking for some quick help.  I also
need to add that I was seeking answers to the above questions in the
context of having access only to the new machine and three more
partitions on it, all of which are smaller than the total uncompressed
/usr directory.
-- 
Regards,
Mick


-- 
gentoo-user@gentoo.org mailing list



Re: [gentoo-user] How to tar?

2006-03-23 Thread Etaoin Shrdlu
On Thursday 23 March 2006 17:46, Michael Kintzios wrote:

> I think I need to go back to basics here to get out of a hole:
>
> I have move my /usr onto a different machine as part of a migration
> exercise, but the partition in question will barely contain it.  Is
> there a way of running tar so that:
>
> 1. Only part of /usr is untarred in a different partition (all of
> /usr/*, except /usr/portage which I want to eventually untar it and
> keep it in there).
> 2. Those directories which are untarred are also removed from the .tgz
> file so that there is enough space left behind to untar the
> /usr/portage directory.
> 3. Finally, /usr/portage is now untarred into the said partition and
> the tgz file is deleted thereafter.

What about doing two separate tar files, one for /usr/portage and the 
other for the rest of /usr? Then untar each tar file into the 
appropriate partition.
-- 
gentoo-user@gentoo.org mailing list



Re: [gentoo-user] How to tar?

2006-03-23 Thread Michael Crute
On 3/23/06, Michael Kintzios <[EMAIL PROTECTED]> wrote:
> I think I need to go back to basics here to get out of a hole:
>
> I have move my /usr onto a different machine as part of a migration
> exercise, but the partition in question will barely contain it.  Is
> there a way of running tar so that:
>
> 1. Only part of /usr is untarred in a different partition (all of
> /usr/*, except /usr/portage which I want to eventually untar it and keep
> it in there).
> 2. Those directories which are untarred are also removed from the .tgz
> file so that there is enough space left behind to untar the /usr/portage
> directory.
> 3. Finally, /usr/portage is now untarred into the said partition and the
>  tgz file is deleted thereafter.
>
> Could you please help with the command/piping syntax?

Hmm... basics... I would start with `man tar` and see where that takes you.

-Mike

--

Michael E. Crute
http://mike.crute.org

It is a mistake to think you can solve any major problems just with potatoes.
--Douglas Adams

-- 
gentoo-user@gentoo.org mailing list