Re: [gentoo-user] tar a brand new Gentoo install to a USB drive for safe keeping?

2008-05-05 Thread Neil Bothwick
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.


signature.asc
Description: PGP signature


Re: [gentoo-user] tar a brand new Gentoo install to a USB drive for safe keeping?

2008-05-05 Thread Ian Graeme Hilt
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



Re: [gentoo-user] tar a brand new Gentoo install to a USB drive for safe keeping?

2008-05-05 Thread Neil Bothwick
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.


signature.asc
Description: PGP signature


Re: [gentoo-user] tar a brand new Gentoo install to a USB drive for safe keeping?

2008-05-04 Thread Jil Larner

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  1320272189304   1063900  16% /var
/dev/sda7 10278304312012   9444184   4% /home
shm1003844 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



Re: [gentoo-user] tar a brand new Gentoo install to a USB drive for safe keeping?

2008-05-04 Thread Neil Bothwick
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


signature.asc
Description: PGP signature


Re: [gentoo-user] tar a brand new Gentoo install to a USB drive for safe keeping?

2008-05-04 Thread Mark Knecht
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 [EMAIL PROTECTED] 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  1320272189304   1063900  16% /var
  /dev/sda7 10278304312012   9444184   4% /home
  shm1003844 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



Re: [gentoo-user] tar a brand new Gentoo install to a USB drive for safe keeping?

2008-05-04 Thread Mark Knecht
On Sun, May 4, 2008 at 8:25 AM, Mark Knecht [EMAIL PROTECTED] 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 [EMAIL PROTECTED]: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



Re: [gentoo-user] tar a brand new Gentoo install to a USB drive for safe keeping?

2008-05-04 Thread Mark Shields
On Sun, May 4, 2008 at 7:12 PM, Mark Knecht [EMAIL PROTECTED] wrote:

 On Sun, May 4, 2008 at 8:25 AM, Mark Knecht [EMAIL PROTECTED] 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 [EMAIL PROTECTED]: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


Re: [gentoo-user] tar a brand new Gentoo install to a USB drive for safe keeping?

2008-05-04 Thread Mark Knecht
On Sun, May 4, 2008 at 5:41 PM, Mark Shields [EMAIL PROTECTED] 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



Re: [gentoo-user] tar a brand new Gentoo install to a USB drive for safe keeping?

2008-05-04 Thread Mark Knecht
On Sun, May 4, 2008 at 6:20 PM, Mark Knecht [EMAIL PROTECTED] wrote:
 On Sun, May 4, 2008 at 5:41 PM, Mark Shields [EMAIL PROTECTED] 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
FilesystemSize  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



Re: [gentoo-user] tar a brand new Gentoo install to a USB drive for safe keeping?

2008-05-04 Thread Ian Graeme Hilt
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 [EMAIL PROTECTED]: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=1chap=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



[gentoo-user] tar a brand new Gentoo install to a USB drive for safe keeping?

2008-05-03 Thread Mark Knecht
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  1320272189304   1063900  16% /var
/dev/sda7 10278304312012   9444184   4% /home
shm1003844 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