public inbox for gentoo-user@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-user] tar a brand new Gentoo install to a USB drive for safe keeping?
@ 2008-05-04  1:06 Mark Knecht
  2008-05-04 10:21 ` Jil Larner
  0 siblings, 1 reply; 16+ messages in thread
From: Mark Knecht @ 2008-05-04  1:06 UTC (permalink / raw
  To: gentoo-user

I've never done this before so it seems like right now would be a
great time to learn. Thanks in advance.

I've just done this installation on my laptop. For the most part it's
working fine. Still a few things to iron out but it's good enough that
I'd like to save the state of the machine so that should something
happen I have a way to restore where I am today. Since the disk usage
is currently about 4GB it seems like a great time to do it. Is this
possible? I think it's essentially what the stage 3 file is that I use
when I install, isn't it? If I can keep the whole thing under 5GB then
I can write it on a DVD and I'm in a really safe space for a fast
reinstall if something happens.

From the running system here's what things look like right now:

laptop1 ~ # df
Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/sda5             15820524   3641240  11375636  25% /
udev                     10240       172     10068   2% /dev
/dev/sda6              1320272    189304   1063900  16% /var
/dev/sda7             10278304    312012   9444184   4% /home
shm                    1003844         0   1003844   0% /dev/shm
laptop1 ~ #

My thought is to boot using the install CD, mount a USB drive at
/mnt/gentoo, then create a mount point 'backup' on the USB drive to
mount each of the 3 partitions I want to back up one at a time. ( /,
/var and /home) Then I'll mount each partition by itself and use tar
to create a single file for each partition where that file gets
written on the USB drive. When I'm done I have 3 files.

Restore would be to create the partitions anew, untar, install grub
from in the chroot, and reboot.

Is this a reasonable way to go? Is there something easier? (That seems
pretty easy to me...)

I don't want to create images of the partitions because I might want
to put the data onto a different drive or in a different
configuration. (Like no /var or something.)

If this makes sense then what commands would I want to use to do this
correctly. Presumably it needs to tar up links, file system
permissions, and everything else. Since the Quick Install guide uses

tar xjpf stage3*

to extract the main directories & files, and assuming the USB drive is
sdb1, would I just use

mount /dev/sdb1 /mnt/gentoo
mount /dev/sda5 /mnt/gentoo/backup
tar cjfp ./ROOT.tar.bz2 backup

and then repeat for the other two partitions? Or is there more to it?

I'm rambling here so I'll hope for a quick answer and then give it a try.

Thanks in advance,
Mark
-- 
gentoo-user@lists.gentoo.org mailing list



^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [gentoo-user] tar a brand new Gentoo install to a USB drive for safe keeping?
  2008-05-04  1:06 [gentoo-user] tar a brand new Gentoo install to a USB drive for safe keeping? Mark Knecht
@ 2008-05-04 10:21 ` Jil Larner
  2008-05-04 12:29   ` Neil Bothwick
  2008-05-04 15:25   ` Mark Knecht
  0 siblings, 2 replies; 16+ messages in thread
From: Jil Larner @ 2008-05-04 10:21 UTC (permalink / raw
  To: gentoo-user

Hi Mark,

Mark Knecht a écrit :
> [...]
> happen I have a way to restore where I am today. Since the disk usage
> is currently about 4GB it seems like a great time to do it. Is this
> possible? I think it's essentially what the stage 3 file is that I use
> when I install, isn't it? 

If you don't export stage3 and /usr/portage/ files, your backup will be 
lighter. The portage tree shouldn't be backed up because it shall be 
outdated when you'll restore, and emerge --sync will bring it back 
(except if you plan to restore in two weeks and have a low speed 
connection so you use emerge-delta-webrsync, but in that case you 
already know why you need to keep the tree).
For stage3, you can safely discard it.

Cf. exclude-dires in man tar

> 
>>From the running system here's what things look like right now:
> 
> laptop1 ~ # df
> Filesystem           1K-blocks      Used Available Use% Mounted on
> /dev/sda5             15820524   3641240  11375636  25% /
> udev                     10240       172     10068   2% /dev
> /dev/sda6              1320272    189304   1063900  16% /var
> /dev/sda7             10278304    312012   9444184   4% /home
> shm                    1003844         0   1003844   0% /dev/shm
> laptop1 ~ #
> 

Tip: use df -h and put it as an alias (alias df='df -h' in .bashrc) ;)

> My thought is to boot using the install CD, mount a USB drive at
> /mnt/gentoo, then create a mount point 'backup' on the USB drive to
> mount each of the 3 partitions I want to back up one at a time. ( /,
> /var and /home) Then I'll mount each partition by itself and use tar
> to create a single file for each partition where that file gets
> written on the USB drive. When I'm done I have 3 files.

Thus, you would be able to restore only one partition if needed, and 
there is less chance that all your archive becomes corrupted. I would 
process the same way.

You also ought to backup the full MBR, which is a good practice, so you 
can bring back your boot sector and the partition table. Backing it up 
if very painless, just a dd command, cf. http://gentoo-wiki.com/MBR . 
And it saves a *lot* of time when restoring (especially when there is 
@&$#! vista partitions with more sectors than there is really on the 
disk...)

> 
> Restore would be to create the partitions anew, untar, install grub
> from in the chroot, and reboot.

So, restore would be a dd command for the MBR, and a mkfs on your 
partitions, then untar your backups. So you wouldn't even need to chroot


> 
> Is this a reasonable way to go? Is there something easier? (That seems
> pretty easy to me...)

It is reasonable, for one single computer. If you've more to manage, 
look at dedicated software, or more complex solution as in 
http://gentoo-wiki.com/HOWTO_Backup

> 
> I don't want to create images of the partitions because I might want
> to put the data onto a different drive or in a different
> configuration. (Like no /var or something.)

With a separate backup of the MBR, you're free to restore it or not ;) 
But if you want to be able to adjust your partition tables, leave free 
space on the drive and take a look at LVM, very powerful and easy to use 
by now (there's a good tutorial on howtoforge with a debian VMWare 
virtual machine)

> 
> If this makes sense then what commands would I want to use to do this
> correctly. Presumably it needs to tar up links, file system
> permissions, and everything else. Since the Quick Install guide uses

You *must* keep permissions of your files, so if you use tar, use -p 
option (cf. man), as if you use cp, use -p option.


> Or is there more to it?

Yep, that's it. Restore mbr, mkfs, mount, untar, sync(or umount), reboot

> 
> I'm rambling here so I'll hope for a quick answer and then give it a try.
> 
> Thanks in advance,
> Mark
-- 
gentoo-user@lists.gentoo.org mailing list



^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [gentoo-user] tar a brand new Gentoo install to a USB drive for safe keeping?
  2008-05-04 10:21 ` Jil Larner
@ 2008-05-04 12:29   ` Neil Bothwick
  2008-05-04 15:25   ` Mark Knecht
  1 sibling, 0 replies; 16+ messages in thread
From: Neil Bothwick @ 2008-05-04 12:29 UTC (permalink / raw
  To: gentoo-user

[-- Attachment #1: Type: text/plain, Size: 539 bytes --]

On Sun, 04 May 2008 12:21:47 +0200, Jil Larner wrote:

> You also ought to backup the full MBR, which is a good practice, so you 
> can bring back your boot sector and the partition table. Backing it up 
> if very painless, just a dd command, cf. http://gentoo-wiki.com/MBR . 

The MBR contains only the primary partitions. If you have an extended
partition, you will need to use sfdisk to make a separate backup of the
logical partition table.


-- 
Neil Bothwick

Crayons can take you more places than starships. * Guinan

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 197 bytes --]

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [gentoo-user] tar a brand new Gentoo install to a USB drive for safe keeping?
  2008-05-04 10:21 ` Jil Larner
  2008-05-04 12:29   ` Neil Bothwick
@ 2008-05-04 15:25   ` Mark Knecht
  2008-05-04 23:12     ` Mark Knecht
  1 sibling, 1 reply; 16+ messages in thread
From: Mark Knecht @ 2008-05-04 15:25 UTC (permalink / raw
  To: gentoo-user

Jil & Neil,
   Thanks for the really great information! I'm going to give this a try today.

   It strikes me that to test my backup I could create a chroot on the
very system I'm backing up. (Or some other system.) I follow the
procedure we're outlining here using the install CD and when it's done
I reboot the system, create a few small partitions in some extra disk
space, untar the files, chroot into that environment, run some
commands to test things, and then put the tar'ed files away for safe
keeping feeling pretty good that everything is where I need it should
the worst happen.

   Again, thanks for the info. I do appreciate it.

Cheers,
Mark

On Sun, May 4, 2008 at 3:21 AM, Jil Larner <jil@gnoo.eu> wrote:
> Hi Mark,
>
>  Mark Knecht a écrit :
>
> > [...]
> >
> > happen I have a way to restore where I am today. Since the disk usage
> > is currently about 4GB it seems like a great time to do it. Is this
> > possible? I think it's essentially what the stage 3 file is that I use
> > when I install, isn't it?
> >
>
>  If you don't export stage3 and /usr/portage/ files, your backup will be
> lighter. The portage tree shouldn't be backed up because it shall be
> outdated when you'll restore, and emerge --sync will bring it back (except
> if you plan to restore in two weeks and have a low speed connection so you
> use emerge-delta-webrsync, but in that case you already know why you need to
> keep the tree).
>  For stage3, you can safely discard it.
>
>  Cf. exclude-dires in man tar
>
>
>
> >
> >
> > > From the running system here's what things look like right now:
> > >
> >
> > laptop1 ~ # df
> > Filesystem           1K-blocks      Used Available Use% Mounted on
> > /dev/sda5             15820524   3641240  11375636  25% /
> > udev                     10240       172     10068   2% /dev
> > /dev/sda6              1320272    189304   1063900  16% /var
> > /dev/sda7             10278304    312012   9444184   4% /home
> > shm                    1003844         0   1003844   0% /dev/shm
> > laptop1 ~ #
> >
> >
>
>  Tip: use df -h and put it as an alias (alias df='df -h' in .bashrc) ;)
>
>
>
> > My thought is to boot using the install CD, mount a USB drive at
> > /mnt/gentoo, then create a mount point 'backup' on the USB drive to
> > mount each of the 3 partitions I want to back up one at a time. ( /,
> > /var and /home) Then I'll mount each partition by itself and use tar
> > to create a single file for each partition where that file gets
> > written on the USB drive. When I'm done I have 3 files.
> >
>
>  Thus, you would be able to restore only one partition if needed, and there
> is less chance that all your archive becomes corrupted. I would process the
> same way.
>
>  You also ought to backup the full MBR, which is a good practice, so you can
> bring back your boot sector and the partition table. Backing it up if very
> painless, just a dd command, cf. http://gentoo-wiki.com/MBR . And it saves a
> *lot* of time when restoring (especially when there is @&$#! vista
> partitions with more sectors than there is really on the disk...)
>
>
>
> >
> > Restore would be to create the partitions anew, untar, install grub
> > from in the chroot, and reboot.
> >
>
>  So, restore would be a dd command for the MBR, and a mkfs on your
> partitions, then untar your backups. So you wouldn't even need to chroot
>
>
>
>
> >
> > Is this a reasonable way to go? Is there something easier? (That seems
> > pretty easy to me...)
> >
>
>  It is reasonable, for one single computer. If you've more to manage, look
> at dedicated software, or more complex solution as in
> http://gentoo-wiki.com/HOWTO_Backup
>
>
>
> >
> > I don't want to create images of the partitions because I might want
> > to put the data onto a different drive or in a different
> > configuration. (Like no /var or something.)
> >
>
>  With a separate backup of the MBR, you're free to restore it or not ;) But
> if you want to be able to adjust your partition tables, leave free space on
> the drive and take a look at LVM, very powerful and easy to use by now
> (there's a good tutorial on howtoforge with a debian VMWare virtual machine)
>
>
>
> >
> > If this makes sense then what commands would I want to use to do this
> > correctly. Presumably it needs to tar up links, file system
> > permissions, and everything else. Since the Quick Install guide uses
> >
>
>  You *must* keep permissions of your files, so if you use tar, use -p option
> (cf. man), as if you use cp, use -p option.
>
>
>
>
> > Or is there more to it?
> >
>
>  Yep, that's it. Restore mbr, mkfs, mount, untar, sync(or umount), reboot
>
>
>
>
> >
> > I'm rambling here so I'll hope for a quick answer and then give it a try.
> >
> > Thanks in advance,
> > Mark
> >
>  --
>  gentoo-user@lists.gentoo.org mailing list
>
>
--
gentoo-user@lists.gentoo.org mailing list



^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [gentoo-user] tar a brand new Gentoo install to a USB drive for safe keeping?
  2008-05-04 15:25   ` Mark Knecht
@ 2008-05-04 23:12     ` Mark Knecht
  2008-05-05  0:41       ` Mark Shields
  2008-05-05  4:04       ` Ian Graeme Hilt
  0 siblings, 2 replies; 16+ messages in thread
From: Mark Knecht @ 2008-05-04 23:12 UTC (permalink / raw
  To: gentoo-user

On Sun, May 4, 2008 at 8:25 AM, Mark Knecht <markknecht@gmail.com> wrote:
> Jil & Neil,
>    Thanks for the really great information! I'm going to give this a try today.
>
>    It strikes me that to test my backup I could create a chroot on the
>  very system I'm backing up. (Or some other system.) I follow the
>  procedure we're outlining here using the install CD and when it's done
>  I reboot the system, create a few small partitions in some extra disk
>  space, untar the files, chroot into that environment, run some
>  commands to test things, and then put the tar'ed files away for safe
>  keeping feeling pretty good that everything is where I need it should
>  the worst happen.
>
>    Again, thanks for the info. I do appreciate it.
>
>  Cheers,
>  Mark
>

Hi all,
   So I'm working on this and ran into a couple of questions about tar.

1) I'm having trouble figuring how to best run tar. I end up with
files at the wrong level every time so far.

Assume I first mount a partition that's empty, and then mount a
partition I want to save that contains a number of system directories
- /, tmp, etc. lib, mnt and others:

mount /dev/sda8 /mnt/gentoo      [[ This is empty except for a mount
point called TarPoint ]]
cd /mnt/gentoo
mount /dev/sda5 TarPoint   [[ The partition I want to backup ]]

Now I can see all my directories under TarPoint. What's the best way
to run tar, creating a file called SYSTEM.tar.bz2 in /mnt/gentoo, so
that later, when I have an empty partition on a different hard drive
(hda) where I'm going to restore the system, I can do this

mount /dev/hda11 /mnt/gentoo
cd /mnt/gentoo
scp mark@server:SYSTEM.tar.bz2 .
tar xvfp SYSTEM.tar.bz2

and I get the system directory hierarchy back again.

2) This laptop is a dual boot machine so the system clock is set to
local when I'm in my Gentoo environment. When I drop into the install
CD I presume it's set to UTC as is the standard. My question has to do
with any requirements to setting time prior to making the tar ball or
untarring to build the environment.

What I'm seeing is that the command

tar xcjf SYSTEM.tar.bz2

generates lots of messages about file times being in the future. Maybe
this won't matter if I use the backup later than 8 hours from the time
I make it but in the short term will it cause any problems?

Thanks,
Mark
-- 
gentoo-user@lists.gentoo.org mailing list



^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [gentoo-user] tar a brand new Gentoo install to a USB drive for safe keeping?
  2008-05-04 23:12     ` Mark Knecht
@ 2008-05-05  0:41       ` Mark Shields
  2008-05-05  1:20         ` Mark Knecht
  2008-05-05  4:04       ` Ian Graeme Hilt
  1 sibling, 1 reply; 16+ messages in thread
From: Mark Shields @ 2008-05-05  0:41 UTC (permalink / raw
  To: gentoo-user

[-- Attachment #1: Type: text/plain, Size: 3029 bytes --]

On Sun, May 4, 2008 at 7:12 PM, Mark Knecht <markknecht@gmail.com> wrote:

> On Sun, May 4, 2008 at 8:25 AM, Mark Knecht <markknecht@gmail.com> wrote:
> > Jil & Neil,
> >    Thanks for the really great information! I'm going to give this a try
> today.
> >
> >    It strikes me that to test my backup I could create a chroot on the
> >  very system I'm backing up. (Or some other system.) I follow the
> >  procedure we're outlining here using the install CD and when it's done
> >  I reboot the system, create a few small partitions in some extra disk
> >  space, untar the files, chroot into that environment, run some
> >  commands to test things, and then put the tar'ed files away for safe
> >  keeping feeling pretty good that everything is where I need it should
> >  the worst happen.
> >
> >    Again, thanks for the info. I do appreciate it.
> >
> >  Cheers,
> >  Mark
> >
>
> Hi all,
>   So I'm working on this and ran into a couple of questions about tar.
>
> 1) I'm having trouble figuring how to best run tar. I end up with
> files at the wrong level every time so far.
>
> Assume I first mount a partition that's empty, and then mount a
> partition I want to save that contains a number of system directories
> - /, tmp, etc. lib, mnt and others:
>
> mount /dev/sda8 /mnt/gentoo      [[ This is empty except for a mount
> point called TarPoint ]]
> cd /mnt/gentoo
> mount /dev/sda5 TarPoint   [[ The partition I want to backup ]]
>
> Now I can see all my directories under TarPoint. What's the best way
> to run tar, creating a file called SYSTEM.tar.bz2 in /mnt/gentoo, so
> that later, when I have an empty partition on a different hard drive
> (hda) where I'm going to restore the system, I can do this
>
> mount /dev/hda11 /mnt/gentoo
> cd /mnt/gentoo
> scp mark@server:SYSTEM.tar.bz2 .
> tar xvfp SYSTEM.tar.bz2
>
> and I get the system directory hierarchy back again.
>
> 2) This laptop is a dual boot machine so the system clock is set to
> local when I'm in my Gentoo environment. When I drop into the install
> CD I presume it's set to UTC as is the standard. My question has to do
> with any requirements to setting time prior to making the tar ball or
> untarring to build the environment.
>
> What I'm seeing is that the command
>
> tar xcjf SYSTEM.tar.bz2
>
> generates lots of messages about file times being in the future. Maybe
> this won't matter if I use the backup later than 8 hours from the time
> I make it but in the short term will it cause any problems?
>
> Thanks,
> Mark
> --
> gentoo-user@lists.gentoo.org mailing list
>
>
Look into what's called a "stage 4 backup":
http://blinkeye.ch/mediawiki/index.php/GNU/Linux_System_Backup_Script_(stage4)

I've had to actually use it once, and it worked fine.  It already excludes
the appropriate files:

/dev
/lost+found
/mnt
/proc
/sys
/tmp
/usr/portage
/usr/src
/var/log
/var/tmp
/var/db
/var/cache/edb

It doesn't back up the MBR or the partition tables (primary or logical),
though you could edit the script to do that.

-- 
- Mark Shields

[-- Attachment #2: Type: text/html, Size: 3988 bytes --]

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [gentoo-user] tar a brand new Gentoo install to a USB drive for safe keeping?
  2008-05-05  0:41       ` Mark Shields
@ 2008-05-05  1:20         ` Mark Knecht
  2008-05-05  2:54           ` Mark Knecht
  0 siblings, 1 reply; 16+ messages in thread
From: Mark Knecht @ 2008-05-05  1:20 UTC (permalink / raw
  To: gentoo-user

On Sun, May 4, 2008 at 5:41 PM, Mark Shields <laebshade@gmail.com> wrote:
>
> Look into what's called a "stage 4 backup":
> http://blinkeye.ch/mediawiki/index.php/GNU/Linux_System_Backup_Script_(stage4)
>
> I've had to actually use it once, and it worked fine.  It already excludes
> the appropriate files:
>
> /dev
> /lost+found
> /mnt
> /proc
> /sys
> /tmp
> /usr/portage
> /usr/src
> /var/log
> /var/tmp
>
> /var/db
> /var/cache/edb
>
> It doesn't back up the MBR or the partition tables (primary or logical),
> though you could edit the script to do that.
>
> --
> - Mark Shields

Thanks Mark. That looks interesting.

I'm not clear about the process of actually making the backup. This
get run on a live file system? I suppose the things it excludes if it
does are the things that might be changing?

- Mark
-- 
gentoo-user@lists.gentoo.org mailing list



^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [gentoo-user] tar a brand new Gentoo install to a USB drive for safe keeping?
  2008-05-05  1:20         ` Mark Knecht
@ 2008-05-05  2:54           ` Mark Knecht
  0 siblings, 0 replies; 16+ messages in thread
From: Mark Knecht @ 2008-05-05  2:54 UTC (permalink / raw
  To: gentoo-user

On Sun, May 4, 2008 at 6:20 PM, Mark Knecht <markknecht@gmail.com> wrote:
> On Sun, May 4, 2008 at 5:41 PM, Mark Shields <laebshade@gmail.com> wrote:
>  >
>  > Look into what's called a "stage 4 backup":
>  > http://blinkeye.ch/mediawiki/index.php/GNU/Linux_System_Backup_Script_(stage4)
>  >
>  > I've had to actually use it once, and it worked fine.  It already excludes
>  > the appropriate files:
>  >
>  > /dev
>  > /lost+found
>  > /mnt
>  > /proc
>  > /sys
>  > /tmp
>  > /usr/portage
>  > /usr/src
>  > /var/log
>  > /var/tmp
>  >
>  > /var/db
>  > /var/cache/edb
>  >
>  > It doesn't back up the MBR or the partition tables (primary or logical),
>  > though you could edit the script to do that.
>  >
>  > --
>  > - Mark Shields
>
>  Thanks Mark. That looks interesting.
>
>  I'm not clear about the process of actually making the backup. This
>  get run on a live file system? I suppose the things it excludes if it
>  does are the things that might be changing?
>
>  - Mark
>

So I tried this out. Although I had a couple of directory issues
getting it ready to go it did run eventually.

My issue at this point is a matter of gaining confidence that it
backed up the right stuff. Considering my file system usage the file
size seems smallish at 1.2G.

lightning ~ # df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/sda2             9.2G  6.5G  2.3G  75% /
udev                   10M  184K  9.9M   2% /dev
/dev/sda6             3.7G  740M  2.8G  21% /usr/src
/dev/sda8              14G   11G  2.5G  82% /home
shm                   497M     0  497M   0% /dev/shm
none                  497M     0  497M   0% /tmp/jack
lightning ~ #

The terminal where it ran said it backed up about 3.3GB into a 1.2GB
file. My file system usage (for a minimal backup) is roughly the 6.5GB
on / since minimal doesn't back up /home and /usr/src which I
convieniently have on separate partitions anyway. I wonder if half of
that 6.6GB really isn't needed?

Anyway, the scripts seemed to have worked, but how to verify? That's
the question.

Could I restore this backup into a different subdirectory somewhere
and then chroot into it?

- Mark
-- 
gentoo-user@lists.gentoo.org mailing list



^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [gentoo-user] tar a brand new Gentoo install to a USB drive for safe keeping?
  2008-05-04 23:12     ` Mark Knecht
  2008-05-05  0:41       ` Mark Shields
@ 2008-05-05  4:04       ` Ian Graeme Hilt
  2008-05-05  8:37         ` Neil Bothwick
  1 sibling, 1 reply; 16+ messages in thread
From: Ian Graeme Hilt @ 2008-05-05  4:04 UTC (permalink / raw
  To: gentoo-user

On Sun, May 04, 2008 at 04:12:08PM -0700, Mark Knecht wrote:
> 1) I'm having trouble figuring how to best run tar. I end up with
> files at the wrong level every time so far.
> 
> Assume I first mount a partition that's empty, and then mount a
> partition I want to save that contains a number of system directories
> - /, tmp, etc. lib, mnt and others:
> 
> mount /dev/sda8 /mnt/gentoo      [[ This is empty except for a mount
> point called TarPoint ]]
> cd /mnt/gentoo
> mount /dev/sda5 TarPoint   [[ The partition I want to backup ]]
> 
> Now I can see all my directories under TarPoint. What's the best way
> to run tar, creating a file called SYSTEM.tar.bz2 in /mnt/gentoo, so
> that later, when I have an empty partition on a different hard drive
> (hda) where I'm going to restore the system, I can do this
> 
> mount /dev/hda11 /mnt/gentoo
> cd /mnt/gentoo
> scp mark@server:SYSTEM.tar.bz2 .
> tar xvfp SYSTEM.tar.bz2

To extract bzip2 files with tar, you need to add the "j" option.

> and I get the system directory hierarchy back again.
> 
> 2) This laptop is a dual boot machine so the system clock is set to
> local when I'm in my Gentoo environment. When I drop into the install
> CD I presume it's set to UTC as is the standard. My question has to do
> with any requirements to setting time prior to making the tar ball or
> untarring to build the environment.
> 
> What I'm seeing is that the command
> 
> tar xcjf SYSTEM.tar.bz2

You have conflicting options there.  To extract, use "x".  To
create, use "c".

> generates lots of messages about file times being in the
> future. Maybe this won't matter if I use the backup later than
> 8 hours from the time I make it but in the short term will it
> cause any problems?

Any problems?  Probably.  They may be inconsequential though.
Follow the instructions below for a possible solution to your
problem.

First, make sure your time is set correctly under UTC with the
date command.  For help with it,
<http://www.gentoo.org/doc/en/handbook/handbook-x86.xml?part=1&chap=5>

Then, you might try setting the TZ variable in the shell
environment to the timezone in which the tar'ed files
resided.  Afterwards, untar the tarball.  Not sure how this will
work in an "install" environment.

-- 
Ian Graeme Hilt
ian.hilt (at) gmail.com
GnuPG key: 0x4AFC1EE3
-- 
gentoo-user@lists.gentoo.org mailing list



^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [gentoo-user] tar a brand new Gentoo install to a USB drive  for safe keeping?
  2008-05-05  4:04       ` Ian Graeme Hilt
@ 2008-05-05  8:37         ` Neil Bothwick
  2008-05-05 12:17           ` Ian Graeme Hilt
  2008-05-06 12:40           ` [gentoo-user] " Michael Schmarck
  0 siblings, 2 replies; 16+ messages in thread
From: Neil Bothwick @ 2008-05-05  8:37 UTC (permalink / raw
  To: gentoo-user

[-- Attachment #1: Type: text/plain, Size: 426 bytes --]

On Mon, 5 May 2008 00:04:44 -0400, Ian Graeme Hilt wrote:

> > tar xvfp SYSTEM.tar.bz2  
> 
> To extract bzip2 files with tar, you need to add the "j" option.

That hasn't been needed for a long time. Tar is able to detect bzip2 and
gzip compression and handle it automatically.


-- 
Neil Bothwick

The nice thing about Windows is - It does not just crash,
it displays adialog box and lets you press OK first.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 197 bytes --]

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [gentoo-user] tar a brand new Gentoo install to a USB drive for safe keeping?
  2008-05-05  8:37         ` Neil Bothwick
@ 2008-05-05 12:17           ` Ian Graeme Hilt
  2008-05-05 12:35             ` Neil Bothwick
  2008-05-06 12:40           ` [gentoo-user] " Michael Schmarck
  1 sibling, 1 reply; 16+ messages in thread
From: Ian Graeme Hilt @ 2008-05-05 12:17 UTC (permalink / raw
  To: gentoo-user

On Mon, May 05, 2008 at 09:37:49AM +0100, Neil Bothwick wrote:
> On Mon, 5 May 2008 00:04:44 -0400, Ian Graeme Hilt wrote:
> 
> > > tar xvfp SYSTEM.tar.bz2  
> > 
> > To extract bzip2 files with tar, you need to add the "j" option.
> 
> That hasn't been needed for a long time. Tar is able to detect bzip2 and
> gzip compression and handle it automatically.

You are correct.  I didn't realize it could detect.  Thanks for
the info.

-- 
Ian Graeme Hilt
ian.hilt (at) gmail.com
GnuPG key: 0x4AFC1EE3
-- 
gentoo-user@lists.gentoo.org mailing list



^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [gentoo-user] tar a brand new Gentoo install to a USB drive  for safe keeping?
  2008-05-05 12:17           ` Ian Graeme Hilt
@ 2008-05-05 12:35             ` Neil Bothwick
  0 siblings, 0 replies; 16+ messages in thread
From: Neil Bothwick @ 2008-05-05 12:35 UTC (permalink / raw
  To: gentoo-user

[-- Attachment #1: Type: text/plain, Size: 480 bytes --]

On Mon, 5 May 2008 08:17:01 -0400, Ian Graeme Hilt wrote:

> > That hasn't been needed for a long time. Tar is able to detect bzip2
> > and gzip compression and handle it automatically.  
> 
> You are correct.  I didn't realize it could detect.  Thanks for
> the info.

It may only save one character when using it fro the command line, but it
makes using tar in scripts a lot cleaner.


-- 
Neil Bothwick

Those who live by the sword get shot by those who don't.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 197 bytes --]

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [gentoo-user]  Re: tar a brand new Gentoo install to a USB drive for safe keeping?
  2008-05-05  8:37         ` Neil Bothwick
  2008-05-05 12:17           ` Ian Graeme Hilt
@ 2008-05-06 12:40           ` Michael Schmarck
  2008-05-06 21:33             ` Neil Bothwick
  2008-05-07 16:01             ` [gentoo-user] " Steven Lembark
  1 sibling, 2 replies; 16+ messages in thread
From: Michael Schmarck @ 2008-05-06 12:40 UTC (permalink / raw
  To: gentoo-user

Neil Bothwick <neil@digimed.co.uk> wrote:

> On Mon, 5 May 2008 00:04:44 -0400, Ian Graeme Hilt wrote:
> 
>> > tar xvfp SYSTEM.tar.bz2
>> 
>> To extract bzip2 files with tar, you need to add the "j" option.
> 
> That hasn't been needed for a long time. Tar is able to detect bzip2 and
> gzip compression and handle it automatically.

That's only true for GNU tar. If you're also dealing with other
systems where you might not have GNU tar, you might be "surprised"
to find that "tar xvf file.tgz" doesn't work.

Hence I think, that it is a good idea to  keep on using z or j.

Michael

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



^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [gentoo-user]  Re: tar a brand new Gentoo install to a USB drive for safe keeping?
  2008-05-06 12:40           ` [gentoo-user] " Michael Schmarck
@ 2008-05-06 21:33             ` Neil Bothwick
  2008-05-08  8:00               ` [gentoo-user] " Michael Schmarck
  2008-05-07 16:01             ` [gentoo-user] " Steven Lembark
  1 sibling, 1 reply; 16+ messages in thread
From: Neil Bothwick @ 2008-05-06 21:33 UTC (permalink / raw
  To: gentoo-user

[-- Attachment #1: Type: text/plain, Size: 751 bytes --]

On Tue, 06 May 2008 14:40:08 +0200, Michael Schmarck wrote:

> > That hasn't been needed for a long time. Tar is able to detect bzip2
> > and gzip compression and handle it automatically.  
> 
> That's only true for GNU tar. If you're also dealing with other
> systems where you might not have GNU tar, you might be "surprised"
> to find that "tar xvf file.tgz" doesn't work.

However, this thread is specifically about using tar on /Gentoo, which
does use GNU tar.

> Hence I think, that it is a good idea to  keep on using z or j.

That really depends on the level of portability your scripts need. Using
z or j is more portable, but also more complex for scripting.


-- 
Neil Bothwick

Top Oxymorons Number 46: Found missing

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 197 bytes --]

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [gentoo-user]  Re: tar a brand new Gentoo install to a USB drive for safe keeping?
  2008-05-06 12:40           ` [gentoo-user] " Michael Schmarck
  2008-05-06 21:33             ` Neil Bothwick
@ 2008-05-07 16:01             ` Steven Lembark
  1 sibling, 0 replies; 16+ messages in thread
From: Steven Lembark @ 2008-05-07 16:01 UTC (permalink / raw
  To: gentoo-user


>>>> tar xvfp SYSTEM.tar.bz2
>>> To extract bzip2 files with tar, you need to add the "j" option.
>> That hasn't been needed for a long time. Tar is able to detect bzip2 and
>> gzip compression and handle it automatically.
>
> That's only true for GNU tar. If you're also dealing with other
> systems where you might not have GNU tar, you might be "surprised"
> to find that "tar xvf file.tgz" doesn't work.
>
> Hence I think, that it is a good idea to  keep on using z or j.

Not all of them speak any squish factor, leaving:

    gzip -dc blah.tar.gz | tar xvf -;

(or bzip/bzip2) as the most portable route.

-- 
Steven Lembark                                            85-09 90th St.
Workhorse Computing                                 Woodhaven, NY, 11421
lembark@wrkhors.com                                      +1 888 359 3508
-- 
gentoo-user@lists.gentoo.org mailing list



^ permalink raw reply	[flat|nested] 16+ messages in thread

* [gentoo-user]  Re: Re: tar a brand new Gentoo install to a USB drive for safe keeping?
  2008-05-06 21:33             ` Neil Bothwick
@ 2008-05-08  8:00               ` Michael Schmarck
  0 siblings, 0 replies; 16+ messages in thread
From: Michael Schmarck @ 2008-05-08  8:00 UTC (permalink / raw
  To: gentoo-user

Neil Bothwick <neil@digimed.co.uk> wrote:

> On Tue, 06 May 2008 14:40:08 +0200, Michael Schmarck wrote:
> 
>> > That hasn't been needed for a long time. Tar is able to detect bzip2
>> > and gzip compression and handle it automatically.
>> 
>> That's only true for GNU tar. If you're also dealing with other
>> systems where you might not have GNU tar, you might be "surprised"
>> to find that "tar xvf file.tgz" doesn't work.
> 
> However, this thread is specifically about using tar on /Gentoo, which
> does use GNU tar.

Well, nonetheless I think that it's a bad idea to get too used to
GNUisms. Especially, if there are so easy "workarounds".

>> Hence I think, that it is a good idea to  keep on using z or j.
> 
> That really depends on the level of portability your scripts need. Using
> z or j is more portable, but also more complex for scripting.

That's rather a question of how complex the "environment" is, that the
script needs to deal with. If you really want to throw all different
sort of things at your script (like .tar.gz, .tar.Z, .tar.bz2, .tar.lzma),
then yes, the script would get more complex.

Michael

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



^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2008-05-08  8:05 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-05-04  1:06 [gentoo-user] tar a brand new Gentoo install to a USB drive for safe keeping? Mark Knecht
2008-05-04 10:21 ` Jil Larner
2008-05-04 12:29   ` Neil Bothwick
2008-05-04 15:25   ` Mark Knecht
2008-05-04 23:12     ` Mark Knecht
2008-05-05  0:41       ` Mark Shields
2008-05-05  1:20         ` Mark Knecht
2008-05-05  2:54           ` Mark Knecht
2008-05-05  4:04       ` Ian Graeme Hilt
2008-05-05  8:37         ` Neil Bothwick
2008-05-05 12:17           ` Ian Graeme Hilt
2008-05-05 12:35             ` Neil Bothwick
2008-05-06 12:40           ` [gentoo-user] " Michael Schmarck
2008-05-06 21:33             ` Neil Bothwick
2008-05-08  8:00               ` [gentoo-user] " Michael Schmarck
2008-05-07 16:01             ` [gentoo-user] " Steven Lembark

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox