Talk:HOWTO Custom Stage4

From Gentoo Linux Wiki

Jump to: navigation, search

Contents

[edit] tarring up /dev ?

Why wasn't /dev listed in the exclusions? I would put it there myself but I'm not an expert.

[edit] Makefile

can somebody write Makefile for backup and recovery like it is in this trick?

[edit] Response

Not necessary IMHO.

[edit] How about adding ability to restore partition table info...

To store partition table info:

dd if=/dev/(your_disk) of=mbr.save count=1 bs=512
sfdisk -d /dev/(your_disk) > partitions.save

The first of those saves the mbr and the second will store all partition info (including logical partitions, which aren't part of the mbr).

To restore partition info:

dd if=mbr.save of=/dev/(your_disk)
sfdisk /dev/hda < partitions.save
added to the article, tnx
ΩD'mitri 11:09, 12 Dec 2004 (GMT)

[edit] runing lilo after untaring stage

I had mount -o bind /dev /mnt/gentoo/dev to get lilo to install on the mbr

Added to the article, tnx
ΩD'mitri 18:28, 15 Dec 2004 (GMT)

[edit] Hint about excluding

what about using the parameter "-l" with tar? -l means to sty in the local filesystem. Means it will exclude /proc /sys /mnt/* and whatever

M

===
jannis suggests: Be sure to exlude any mounted data-partitions (/mnt/windows/* or /mnt/*), cd-roms (/mnt/cdrom*) and network-mounts (samba, NFS, ...) or you'll have a great mass of useless data in the backup because when having restored the system., you can just mount them again.
===

[edit] Problem with udev after stage4 restore

After the stage4 restore I obtain an error like "the initial console is missing", I've resolved this issue using gentoo udev guide

[edit] Add "/media" to dir_excludes

If you're using hal/dbus you need to add directory /media to dir_excludes variable in the mkstage4.sh script (this directory's like /mnt)

[edit] Re/Installing Grub after restore

For anyone having problems installing grub, try the following, using the LiveCD:
{as root}

cp -R /dev/* /mnt/gentoo/dev

{edit your grub.conf}

mount -t proc none /mnt/gentoo/dev
chroot /mnt/gentoo /bin/bash
grub
 >root (hd0,1) {replace with your boot drive/partition ID}
 >setup (hd0) {replace with your drive ID}
 >quit

[edit] Whithout copying /dev/*

It's not necessary at all, /dev will be regenerated at the next reboot. This will leave all stuff we copied as unidentified garbage. Best method:

mount -o bind /dev /mnt/gentoo/dev/
mount -t proc none /mnt/gentoo/proc
mount -o bind /sys /mnt/gentoo/sys
chroot /mnt/gentoo/ /bin/bash
env-update
source /etc/profile
grub
...

[edit] General Posting Rules

Here is a general suggestion for this HowTo:

Lets remove every "I" from the HowTo.
If anybody wants to say "I" he should also identify himself with a name, even if it is a nickname.
This makes quoting and referring easier and the HowTo looks more "professional".

[edit] Removed warning about "/var/tmp/portage/homedir"

This was the warning

Warning: Do NOT remove "/var/tmp/portage/homedir"! It will result in problems with portage.

but in the Running out of diskspace FAQ the homedir thing is not mentioned. I've always typed a simple rm -R /var/tmp/portage/* without problems. I have removed it, restore it if someone disagree . Jack --82.52.24.87 18:37, 1 April 2006 (GMT)

[edit] ntpd warning

If you're using ntpd, you probably want to exclude your driftfile, as it is specific to your hardware. I didn't think of this when I moved my install to a new machine, and the clock drifted very badly, because the clock on my old machine had been very bad and ntpd was overcompensating significantly on my new hardware. Ben Morris 11:26, 26 September 2006 (UTC)

Is it worth putting this (rephrased) in the main article? Or in the HOWTO NTP article? What do other people think? Ben Morris 11:26, 26 September 2006 (UTC)

[edit] permissions

in my experience there is no need to use the -p option with tar when creating the tarball... that option is only needed when a non-root user extracts the tarball.

fctk 10:34, 24 December 2006 (UTC)

[edit] UDEV

Please be sure to have udev < 0.99 installed, with udev 1.x the bootprocess will hang up and give a reboot allways the same time. The stage4 must include udev < 0.99! gentoo 2006.1 wont support udev > 0.99

pima ^at^unixmail DOT.com


Agree: -p in creation tarball is useless: if you RTFM is stated clearly ;) I corrected the wiki.

deadhead 11:50, 10 January 2007 (UTC)

Is the above statement still valid? I'm using udev 105. Will this stage4 backup work for me?

Maybe /etc/udev/rules.d/70-persistent-net.rules should be added to the excludes list also. If you are moving a stage 4 between two different computers, the NIC will get set up as eth1 instead of eth0 unless this file is excluded. udev re-creates it on boot. --Shibz 16:44, 22 April 2007 (UTC)

[edit] Excluding files that contain a space

You can exclude files that contain a space by...

a) Using Bash's internal IFS variable to change the Internal Field Separator to something other than the default whitespace, e.g. a comma. This will allow you to list filenames that contain a space.

b) Using sed to perform a regexp replacement of all spaces with question marks when creating a new --excludes arguement. This prevents tar complaining. (note that escaping the spaces instead makes no difference - tar still complains).

The following is an example, where I have modified the exclude list part of the script to exclude the vmware Virtual Machines directory. Remember to unset IFS to return it to its default value - to avoid potential problems later on in the script.

Code: mkstage4.sh changes
 
IFS=$',' # Change the Internal Field Separator to a comma, so we can exclude files that contain spaces.

##  Directories/files that will be exluded from the stage 4 tarball.
##
##  Add directories that will be recursively excluded, delimited by a comma.
##  Be sure to omit the trailing /
dir_excludes="/mnt/*,/var/lib/vmware/Virtual Machines,/var/lib/vmware/Virtual Machines/*,/dev,/proc,/sys,/tmp,/usr/portage,/var/tmp"
##
##  Add files that will be excluded, delimited by a comma.
##  You can use the * wildcard for multiple matches.
##  There should always be $archive listed or bad things will happen.
file_excludes="$archive"
##
##  Combine the two *-excludes variables into the $excludes variable
##  Spaces in a filename will be replaced with the ? character.
excludes="$(for i in $dir_excludes; do if [ -d $i ]; then \
    echo -n " --exclude=$(echo $i | sed 's/ /\?/g')/*"; fi; done) $(for i in $file_excludes; do \
    echo -n " --exclude=$(echo $i | sed 's/ /\?/g')"; done)"

unset IFS # Unset the IFS to return it to the default whitespace separator.

Note that I've only tried this with the first mkstage4.sh script listed on the page (created by BrianW on 2006.03.05 then added to later by odessit on 2006.07.20) - I'm not sure whether it's necessary for the other scripts.

- stephandale (gentoo forums). I'm not sure of the protocol when editing wiki pages. Delete this entry or PM me via the forums if there's a problem. Thanks.

when we exclude from archiving /usr/src/* we lose our kernel sources and .config file.

when we recover it's not possible to fix kernel (but the biult kernel is in /boot and its ok to boot).

so, i don't understand this exclusion.

[edit] /var/lib/dhcpcd

When cloning machines, it is important to empty /var/lib/dhcpcd in the new hosts. Otherwise, this message will appear (see this thread):

ARPOP_REPLY received from

Mimosinnet 05:51, 18 April 2008 (UTC)

Personal tools