You are not logged in.

#1 2006-10-16 18:35:59

Snarkout
Member
Registered: 2005-11-13
Posts: 542

Moving existing install from one disk to another?

The title pretty much says it all - I'm looking for a good solution that will allow me to move an existing install from one disk to another.  I'm fairly certain ghost isn't going to do everything I need it to here since this system has been up and kicking for over a year at this point and has been pretty well customized.  I've seen some solutions using dd, but a) I won't be using similar hardware, and b) I do not wat to backup unused partitioned space.  I've also seen rsync or netcat used in other places, but a lot of thise solutions look pretty hackish.  Has anyone done this succesfully?  Is it better to start with a bare system, and then just move running data?  If so, how do you avoid stuff like /proc or /sys (I'm assuming backing these up via rsync wouldn't go well, and is a bad idea anyhow).  Ideas?


Unthinking respect for authority is the greatest enemy of truth.
-Albert Einstein

Offline

#2 2006-10-16 21:57:26

mr.MikyMaus
Member
From: disabled
Registered: 2006-03-31
Posts: 285

Re: Moving existing install from one disk to another?

Just copy it! wink If you use stock kernel, you won't have to bother about hardware (maybe except of some fine tunning and X, but you would have to do that anyway).

Boot some live cd, mount all old and new disks/partitions and just copy all files except directories /sys and /proc. DO copy /dev!

Then edit the new fstab file to match your new partitions and make directories /sys and /proc. Also make sure your boot loader is configured properly.

DO NOT FORGET to copy your files with all their rights! Double check you have the "preserve attributes" checked in MC's copy dialog.

I did this many times, it works wink

-Miky.

P.S. You don't have to bother about /sys and /proc since these are just pseudo-filesystems. These directories are in fact empty, the kernel makes their content 'on the fly'...


What happened to Arch's KISS? systemd sure is stupid but I must have missed the simple part ...

... and who is general Failure and why is he reading my harddisk?

Offline

#3 2006-10-16 22:17:42

chrismortimore
Member
From: Edinburgh, UK
Registered: 2006-07-15
Posts: 655

Re: Moving existing install from one disk to another?

I mirror my installation using this script:

#!/bin/bash
RSYNCOPTS="--archive --delete --links --progress --stats --verbose"
if [ "$1" == "marbles" ]; then
        rsync ${RSYNCOPTS} --exclude /dev --exclude /mnt --exclude /proc --exclude /sys --exclude /tmp --exclude /var/tmp --exclude *lost+found / /mnt/backup/system/marbles/
fi

if [ "$1" == "toaster" ]; then
        rsync ${RSYNCOPTS} --exclude /dev/ --exclude /home/chris/music --exclude /home/chris/vids --exclude /mnt --exclude /proc --exclude /sys --exclude /tmp --exclude /var/tmp --exclude *lost+found --rsh=ssh toaster:/ /mnt/backup/system/toaster/
fi

If I run "backup marbles", it backs up the local machine.  If I run "backup toaster", it backs up my laptop through SSH.  The result can be chrooted into and all sorts, it's essentially a working installation, minus a few folders (basically the stuff in the --excludes).

I've also frequently used the command "cp -av [source] [target]" to move installations from one drive to another.  Example: "cp -av /mnt/olddrive/* /mnt/newdrive/", and wait till it's done.


Desktop: AMD Athlon64 3800+ Venice Core, 2GB PC3200, 2x160GB Maxtor DiamondMax 10, 2x320GB WD Caviar RE, Nvidia 6600GT 256MB
Laptop: Intel Pentium M, 512MB PC2700, 60GB IBM TravelStar, Nvidia 5200Go 64MB

Offline

#4 2006-10-16 22:34:05

Snarkout
Member
Registered: 2005-11-13
Posts: 542

Re: Moving existing install from one disk to another?

Thanks to both of you - essentially what I hoped.  I guess I can either do that from one working install to a base install on another system/disk or figure out how to move grub to the MBR of a non-working disk with all my data on it.


Unthinking respect for authority is the greatest enemy of truth.
-Albert Einstein

Offline

#5 2006-10-16 23:01:51

mr.MikyMaus
Member
From: disabled
Registered: 2006-03-31
Posts: 285

Re: Moving existing install from one disk to another?

Snarkout wrote:

...or figure out how to move grub to the MBR of a non-working disk with all my data on it.

all you have to do is grub-install /dev/hda (or hdb or whatever) to install grub to MBR. Good idea prior to this is mount your boot partition to /boot wink

My opinion is that if you only want to transfer your system from one (physical) disk to another at once, you just mount (physically) both of these disks into one machine and copy the files and edit configs as I suggested. Then just mount your new wannabe boot partition to /boot, copy your old /boot's content there and run grub-install /dev/hdx (or sdx if your drive is SATA/SCSI)..

Do not use Slax for this since it does not have Grub by default!

Rsync is good for making regular backups (afaik, imho smile ), but using it for one-time transfer is a little bit too rough wink

-M.


What happened to Arch's KISS? systemd sure is stupid but I must have missed the simple part ...

... and who is general Failure and why is he reading my harddisk?

Offline

#6 2006-10-16 23:20:26

Snarkout
Member
Registered: 2005-11-13
Posts: 542

Re: Moving existing install from one disk to another?

I've got about 15 - 20 rsync scripts I run nightly (sysadmin) but I have never tried migrating an *entire* installation like this before.  Generally I just migrate /etc and user data to a new upgraded install, and hammer out all the dings and dents before bringing the box online.  I tend to use --azv --delete rather than longhand, but those are very nicely self commenting scripts.  I'm thinking of changing mine to that form so whoever has to inherit the mess I leave behind (and god knows I've inherited quite a mess myself) can glean wtf my scripts do a little easier.  Thanks again!


Unthinking respect for authority is the greatest enemy of truth.
-Albert Einstein

Offline

#7 2006-10-17 09:20:31

chrismortimore
Member
From: Edinburgh, UK
Registered: 2006-07-15
Posts: 655

Re: Moving existing install from one disk to another?

Snarkout wrote:

I've got about 15 - 20 rsync scripts I run nightly (sysadmin) but I have never tried migrating an *entire* installation like this before.  Generally I just migrate /etc and user data to a new upgraded install, and hammer out all the dings and dents before bringing the box online.

I agree that rsync is daft for system migration.  However, if your backups are as complete as mine (I like being able to restore my computer by just using "cp", hence backing up that much), then essentially the backup is the migrated system you are aiming for.  Whenever I migrate, I always just run the backup script, and copy everything from the backup drive to the new destination.

And I use the long hand versions because it's in a script (so I don't need to worry about masses of typing), I keep forgetting what the rsync options do (I don't really use it direct from the terminal often enough to remember, only in the occasional script), and it makes it easier to debug.


Desktop: AMD Athlon64 3800+ Venice Core, 2GB PC3200, 2x160GB Maxtor DiamondMax 10, 2x320GB WD Caviar RE, Nvidia 6600GT 256MB
Laptop: Intel Pentium M, 512MB PC2700, 60GB IBM TravelStar, Nvidia 5200Go 64MB

Offline

#8 2006-10-17 12:54:08

Snarkout
Member
Registered: 2005-11-13
Posts: 542

Re: Moving existing install from one disk to another?

I don't think it's daft at all - at least not when you have to migrate a live system.  Rsync takes a lot more time initially, but the error checking is a nice feature, and the more times you run it in succession, the less time it takes.

Example:  I recently had to upgrade an existing webmail server; hardware, software, everything.  So we got the OS up and running on the new box, and ran an rsync backup script about 4 - 6 times over a few hours - first from the nightly backup, then once to diff the two, then about once an hour for a few hours to keep sync.  We put up a dummy page, took the box offline for about a total of 20 min since the last few rsyncs took only a few seconds apiece rather than the 2 - 3 hours it would have taken otherwise, and brought it back up on the new box, working perfectly.

In fact, come to think of it, I tend to use rsync fairly often when I *could* use scp.  It just has a lot of features I like, and is far better for incremental backups than scp is.  The initial hash does take a long, long time, though.  One place I have learned to avoid rsync is when I'm moving single multi-gig files - the hashing takes forever still, and since you have to copy the *entire* file over if it bombs out in the middle of a backup in any event scp + md5 is usually more suitable for my needs.


Unthinking respect for authority is the greatest enemy of truth.
-Albert Einstein

Offline

Board footer

Powered by FluxBB