|
|
Please note: The method described here is an updated version of the post on this forum. I do not intend to translate it into chinese, also I do not think it is necessary.
Please note: The method described here is an updated version of the post on this forum. I do not intend to translate it into chinese, also I do not think it is necessary.
Please note: The method described here is an updated version of the post on this forum. I do not intend to translate it into chinese, also I do not think it is necessary.
How to Stage IV of Gentoo Linux
Boot your computer using Install CD minimal, and this time folder /proc is empty. Also, due to Grub find stage1 and stage 1.5 in a physical Head/Cylinder/Sector way, if you mount /boot partition the code in MBR will not find stage files any more. So, usually after emerge grub, I unmerge it from my system with /boot partition not mouned. In this way, grub is “fake” unmerged from my box. Forget it forever, don’t touch /boot partition also by mounting it with noauto option. Forget /boot too.
1. To backup the whole system installed on hdaX, mount target and source partition.- #mount /dev/hdaX /mnt/gentoo
- #mount /dev/hdaY /mnt/backup
复制代码 2. To backup Gentoo system with files in /mnt/linux/usr/portage/distfiles excluded.- #cd /mnt/linux
- #tar -cj --exclude=usr/portage/distfiles -pivf /mnt/backup/Stage4.tar.bz2 *
复制代码 **If you want to burn disc (CDs), you can split the backup file into smaller ones:- #split -a 1 -b 650m /mnt/backup/Stage4.tar.bz2 /mnt/backup/Stage4.tar.bz2-
复制代码 Several packages with one-alphabet appendix will be generated in backup folder such as
Stage4.tar.bz2-a, Stage4.tar.bz2-b...etc, the maximum size is 650M.
3. To restore the system just combine the packages and unpack it:
Also, boot the computer use Install CD minimal, format target partition.- #mkreiserfs /dev/hdaX
- #mount /dev/hdaX /mnt/gentoo
- #mount /dev/hdaY /mnt/backup
- #cd /mnt/gentoo
- #cat /mnt/backup/Stage4.tar.bz2-* | tar -xjvf -
复制代码 If you do not like split backup file, like me, just unpack is enough- #cd /mnt/gentoo
- #tar -xjvf /mnt/backup/Stage4.tar.bz2
复制代码 Reboot, now we are back to the future.
Notes:
1. Before backup you should mount all the partition which you want to pack into backup file. For example, if your /usr is a separated partition, you must mount it first.
2. If there are several directories that you do not want to backup such as /usr/portage/distfiles etc, you can write down them in a file called exclude-list (Or any name you like) line by line, one line on folder.
Like this:- # Begin of the example of excluded folder
- usr/portage/distfiles
- var/tmp/portage
- home/yourusername/music
- home/yourusername/video
- # End of the example of excluded folder
复制代码 Put it into your root folder, then- #tar -cj --exclude-from /mnt/gentoo/root/exclude-list -pivf /mnt/backup/Stage4.tar.bz2 *
复制代码 3. something weird, the result of the following two commands it different, please notice - #tar -cj --exclude=usr/portage/distfiles -pivf /mnt/backup/Stage4.tar.bz2 *
- #tar -cj --exclude=usr/portage/distfiles/ -pivf /mnt/backup/Stage4.tar.bz2 *
复制代码 4. Due the the execute speed problem, when unpack there may be some problem
When backup- #tar -cjpivO /mnt/backup/Stage4.tar.bz2 * | split -a 1 -b 650m - /mnt/backup/Stage4.tar.bz2-
复制代码 When restore- #cat /mnt/backup/Stage4.tar.bz2-* | tar -xjvf –
复制代码 Some warning may appeare, just ignore them. If you feel uncomfortable, split them into two commands.
When backup- #tar -cj --exclude=usr/portage/distfiles -pivf /mnt/backup/Stage4.tar.bz2 *
- #split -a 1 -b 650m /mnt/backup/Stage4.tar.bz2 /mnt/backup/Stage4.tar.bz2-
复制代码 When restore- #cat /mnt/backup/Stage4.tar.bz2-* >> /mnt/gentoo/Stage4.tar.bz2
- #cd /mnt/gentoo/
- #tar -xjvpf Stage4.tar.bz2
复制代码 Please note, the target file Stage4.tar.bz2 may be very large, be patient.
5. To place porage tree together disfiles to a separated partition is a VERY good idea. 4GB space is enough. Thus, you do not need to backup, restore and synchronize portage tree again. Backup and restore become like this:- #tar -cjpivf /mnt/backup/Stage4.tar.bz2 *
- #tar -xjvpf Stage4.tar.bz2
复制代码 6: Options:
Options for tar- -p: --preserve-permissions
- -f: --file
- -v: --verbose
- -j: --bzip
- -z: --gzip/--ungzip
- -c: --create
- -i: --ignore-zeros
- -O: To standout
- -x: --extract
- -: stdin/stdout
复制代码 Options for split- -a: suffix_length=N
- -b: --byte=SIZE [K/M]
复制代码 |
|