Linux Archive

Linux Archive (http://www.linux-archive.org/)
-   Gentoo User (http://www.linux-archive.org/gentoo-user/)
-   -   untaring backup as a test (http://www.linux-archive.org/gentoo-user/84118-untaring-backup-test.html)

"Mark Knecht" 05-08-2008 02:49 AM

untaring backup as a test
 
Hi,
I'd just like to confirm this before I make a mistake and hurt my system.

The existing system drive is /dev/sda:

/dev/sda3 is root
/dev/sda1 is boot

That's all there is.

Using the stage4 tar I idea I added a drive which is /dev/sdb and
has these partitions of interest

/dev/sdb3 will be new root
/dev/sdb1 will be new boot
/dev/sdb5 will be new var
/dev/sdb6 will be new video

I've mounted the new drive under /mnt like this:

/dev/sdb3 /mnt/backups [[[This will be the new / ]]]
/dev/sdb1 /mnt/backups/boot
/dev/sdb5 /mnt/backups/var
/dev/sdb6 /mnt/backups/video

So this essentially creates a new file system that will eventually
take over when I boot from this drive tomorrow. (Hopefully)

Now, in the video directory I have my stage4 tar file which I want to
untar into this new drive and not, hopfully, over my old drive. Will
the following work?

cd /mnt/backups
tar xjpf video/Sector9-stage4-2008.05.07-custom.tar.bz2

I'm just trying to be really careful here. I think this is all an
extension of how we build a Gentoo machine by untaring a stage3 file
but I'm doing it on a system that's live and I don't want to mess up
the exiting drive.

If this is correct then I'll chroot into the new environment for
testing, adding grub, etc., and then do a BIOS change to boot off of
the second drive and hopefully be live.

Thanks,
Mark
--
gentoo-user@lists.gentoo.org mailing list

"Wang, Baojun" 05-08-2008 03:07 AM

untaring backup as a test
 
在 2008-05-07三的 19:49 -0700,Mark Knecht写道:
> Hi,
> I'd just like to confirm this before I make a mistake and hurt my system.
>
> The existing system drive is /dev/sda:
>
> /dev/sda3 is root
> /dev/sda1 is boot
>
> That's all there is.
>
> Using the stage4 tar I idea I added a drive which is /dev/sdb and
> has these partitions of interest
>
> /dev/sdb3 will be new root
> /dev/sdb1 will be new boot
> /dev/sdb5 will be new var
> /dev/sdb6 will be new video
>
> I've mounted the new drive under /mnt like this:
>
> /dev/sdb3 /mnt/backups [[[This will be the new / ]]]
> /dev/sdb1 /mnt/backups/boot
> /dev/sdb5 /mnt/backups/var
> /dev/sdb6 /mnt/backups/video
>
> So this essentially creates a new file system that will eventually
> take over when I boot from this drive tomorrow. (Hopefully)
>
> Now, in the video directory I have my stage4 tar file which I want to
> untar into this new drive and not, hopfully, over my old drive. Will
> the following work?
>
> cd /mnt/backups
> tar xjpf video/Sector9-stage4-2008.05.07-custom.tar.bz2
>
> I'm just trying to be really careful here. I think this is all an
> extension of how we build a Gentoo machine by untaring a stage3 file
> but I'm doing it on a system that's live and I don't want to mess up
> the exiting drive.
I think you don't have to tar/untar, using rsync is more straight forward.

just like:

mount /dev/sdb3 /install
cd /install
rsync -av /* . --exclude=/dev --exclude=/proc --exclude=/sys
--exclude=/tmp --exclude=/var/tmp --exclude=/selinux --exclude=...
make sure /sys, /proc are not included (probably also /tmp, /var/tmp)

then:

mkdir -p tmp var/tmp
chmod 1777 tmp var/tmp

mount /dev/sda3 /mnt/temp # orignal / directory
cp -av /mnt/temp/dev . # rsync /dev, not directly because /dev is
dynamically mounted by udev.
mkdir -p sys proc selinux ...

please also don't forget mount /boot before rsync (or tar/untar).

> If this is correct then I'll chroot into the new environment for
> testing, adding grub, etc., and then do a BIOS change to boot off of
> the second drive and hopefully be live.
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

for your instance, please also don't forget modify /etc/fstab (if
neccessary), but you could also use disklabel/uuid instead of raw
harddisk names), ie:

LABEL=/gentoo / ext3 noatime 0 0
UUID=whatever /var reiserfs noatime,notail,nosuid 0 0
...

> Thanks,
> Mark
--
Wang, Baojun Lanzhou University
Distributed & Embedded System Lab http://dslab.lzu.edu.cn
School of Information Science and Engeneering wangbj@dslab.lzu.edu.cn
Tianshui South Road 222. Lanzhou 730000 .P.R.China
Tel: +86-931-8912025 Fax: +86-931-8912022


All times are GMT. The time now is 04:26 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.