Gentoo Archives: gentoo-user

From: "Wang
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] untaring backup as a test
Date: Thu, 08 May 2008 03:07:37
Message-Id: 1210216040.17622.6.camel@localhost
In Reply to: [gentoo-user] untaring backup as a test by Mark Knecht
1 在 2008-05-07三的 19:49 -0700,Mark Knecht写道:
2 > Hi,
3 > I'd just like to confirm this before I make a mistake and hurt my system.
4 >
5 > The existing system drive is /dev/sda:
6 >
7 > /dev/sda3 is root
8 > /dev/sda1 is boot
9 >
10 > That's all there is.
11 >
12 > Using the stage4 tar I idea I added a drive which is /dev/sdb and
13 > has these partitions of interest
14 >
15 > /dev/sdb3 will be new root
16 > /dev/sdb1 will be new boot
17 > /dev/sdb5 will be new var
18 > /dev/sdb6 will be new video
19 >
20 > I've mounted the new drive under /mnt like this:
21 >
22 > /dev/sdb3 /mnt/backups [[[This will be the new / ]]]
23 > /dev/sdb1 /mnt/backups/boot
24 > /dev/sdb5 /mnt/backups/var
25 > /dev/sdb6 /mnt/backups/video
26 >
27 > So this essentially creates a new file system that will eventually
28 > take over when I boot from this drive tomorrow. (Hopefully)
29 >
30 > Now, in the video directory I have my stage4 tar file which I want to
31 > untar into this new drive and not, hopfully, over my old drive. Will
32 > the following work?
33 >
34 > cd /mnt/backups
35 > tar xjpf video/Sector9-stage4-2008.05.07-custom.tar.bz2
36 >
37 > I'm just trying to be really careful here. I think this is all an
38 > extension of how we build a Gentoo machine by untaring a stage3 file
39 > but I'm doing it on a system that's live and I don't want to mess up
40 > the exiting drive.
41 I think you don't have to tar/untar, using rsync is more straight forward.
42
43 just like:
44
45 mount /dev/sdb3 /install
46 cd /install
47 rsync -av /* . --exclude=/dev --exclude=/proc --exclude=/sys
48 --exclude=/tmp --exclude=/var/tmp --exclude=/selinux --exclude=...
49 make sure /sys, /proc are not included (probably also /tmp, /var/tmp)
50
51 then:
52
53 mkdir -p tmp var/tmp
54 chmod 1777 tmp var/tmp
55
56 mount /dev/sda3 /mnt/temp # orignal / directory
57 cp -av /mnt/temp/dev . # rsync /dev, not directly because /dev is
58 dynamically mounted by udev.
59 mkdir -p sys proc selinux ...
60
61 please also don't forget mount /boot before rsync (or tar/untar).
62
63 > If this is correct then I'll chroot into the new environment for
64 > testing, adding grub, etc., and then do a BIOS change to boot off of
65 > the second drive and hopefully be live.
66 I think it will be easier to use LVM then you don't have to manage raw harddisk names like hdaX or hdbX, also it's more flexible and easier to management
67
68 for your instance, please also don't forget modify /etc/fstab (if
69 neccessary), but you could also use disklabel/uuid instead of raw
70 harddisk names), ie:
71
72 LABEL=/gentoo / ext3 noatime 0 0
73 UUID=whatever /var reiserfs noatime,notail,nosuid 0 0
74 ...
75
76 > Thanks,
77 > Mark
78 --
79 Wang, Baojun Lanzhou University
80 Distributed & Embedded System Lab http://dslab.lzu.edu.cn
81 School of Information Science and Engeneering wangbj@×××××××××××××.cn
82 Tianshui South Road 222. Lanzhou 730000 .P.R.China
83 Tel: +86-931-8912025 Fax: +86-931-8912022

Attachments

File name MIME type
signature.asc application/pgp-signature