Java Mailing List Archive

http://www.redhatconfig.com/

Home » Gentoo Linux »

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

Jil Larner

2008-05-04

Replies: Find Java Web Hosting

Author LoginPost Reply
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@(protected)

©2008 redhatconfig.com - Jax Systems, LLC, U.S.A.