You are not logged in.

#1 2005-04-08 20:49:43

mico
Member
From: Slovenia
Registered: 2004-02-08
Posts: 247

Transfer system to another hard disk

How exactly do you do this without reinstall? I have an old drive in my laptop that is too loud and small and would like to replace it. Before I buy a new one, I'd like to get some info on how hard it is to transfer everything to another disk. I can put only 1 disk in laptop. I have only one partition besides swap. The laptop is old and too slow to bother with fresh install and all the custom-compiled packages. So I'm thinking about nfs:

1. boot knoppix on laptop, set up nfs server, set no_root_squash in /etc/exports

2. nfs mount on my workstation as root

3. cp -a /mnt/nfs-laptop /laptop-files

4. replace disk on laptop, create partitions, again boot knoppix on laptop

5. mkreiserfs /dev/hda1

6. do the same with nfs, only this time laptop (knoppix) is nfs client

7. cp -a /mnt/nfs-workstation where-hda1-is-mounted

8. chroot where-hda1-is-mounted

9. run lilo

Will this work and everything will be the same as before? The kernel, packages, all settings, database entries, ... I think it should be, but I've never done this before so I'd rather ask before buying another disk (even used laptop disks are not so cheap here).

One more thing: now I have ext3 filesystem on laptop. If I copy the system to a reiserfs partition, could that cause any problems?

Offline

#2 2005-04-08 21:54:38

lanrat
Member
From: Poland
Registered: 2003-10-28
Posts: 1,274

Re: Transfer system to another hard disk

Looks ok though I've never tried it with nfs.
Read this thread too:
http://bbs.archlinux.org/viewtopic.php?t=10754
and this howto
http://www.ibiblio.org/mdw/HOWTO/Hard-D … index.html
Maybe you'll find something else. You sholdn't copy everything (like /proc /sys /tmp).

Offline

#3 2005-04-08 22:25:29

mico
Member
From: Slovenia
Registered: 2004-02-08
Posts: 247

Re: Transfer system to another hard disk

Thanks for links, I'll do some reading.

lanrat wrote:

You sholdn't copy everything (like /proc /sys /tmp).

That's why I plan to boot knoppix on laptop on both nfs mounts. I think this way /proc will be empty (?), /tmp and all other dirs will be in state of a stopped system, whatever that may be. I'm running debian with static /dev on that laptop, so /sys is empty anyway. So probably I could simply copy everything, but correct me if I'm wrong. I will however check /proc to be sure it's empty.

Offline

#4 2005-04-08 23:05:37

tomk
Forum Fellow
From: Ireland
Registered: 2004-07-21
Posts: 9,839

Re: Transfer system to another hard disk

Another option is partimage, which is included in Knoppix. I used this when I upgraded my laptop hard drive a while ago.

Offline

#5 2005-04-09 12:24:29

lanrat
Member
From: Poland
Registered: 2003-10-28
Posts: 1,274

Re: Transfer system to another hard disk

mico wrote:

So probably I could simply copy everything, but correct me if I'm wrong. I will however check /proc to be sure it's empty.

IIRC I just used the third method from the howto (specify each top level directory to be copied) :-)
I mentioned the dirs above because when I forgot to exclude /sys cp segfaulted while copying it (but I was doing it in single user mode from one hd to another attached to the second ide).
The howto pretty much explains everything that is needed. I only had to figure out myself how to install grub (I did chroot to mounted directory with new hd root dir, run grub, setup root, find stage1 file - In my case with separate boot partition I had to shorten the path by removing boot, run setup). I'll leave an url here just for the record:
http://www.gnu.org/software/grub/manual … ively.html

BTW Beeing able to just copy all files from one place to another to upgrade hardrive is one of the best things in linux 8)

Offline

#6 2005-04-09 13:25:25

RedShift
Member
From: Belgium
Registered: 2004-07-16
Posts: 230

Re: Transfer system to another hard disk

lanrat wrote:
mico wrote:

So probably I could simply copy everything, but correct me if I'm wrong. I will however check /proc to be sure it's empty.

IIRC I just used the third method from the howto (specify each top level directory to be copied) :-)
I mentioned the dirs above because when I forgot to exclude /sys cp segfaulted while copying it (but I was doing it in single user mode from one hd to another attached to the second ide).
The howto pretty much explains everything that is needed. I only had to figure out myself how to install grub (I did chroot to mounted directory with new hd root dir, run grub, setup root, find stage1 file - In my case with separate boot partition I had to shorten the path by removing boot, run setup). I'll leave an url here just for the record:
http://www.gnu.org/software/grub/manual … ively.html

BTW Beeing able to just copy all files from one place to another to upgrade hardrive is one of the best things in linux 8)

You can do that with windows too ;-)


:?

Offline

#7 2005-04-09 15:45:26

jerem
Member
From: France
Registered: 2005-01-15
Posts: 310

Re: Transfer system to another hard disk

Do you know about the Gentoo's unofficial stage 4 ?
This method can be applied to Arch...

It's basically a tar.bz2 of you whole filesystem, excluding things like /proc, /sys, /tmp, etc...

tar -cvjpf /whatever.tar.bz2 / --exclude=/proc --exclude=/sys etc...

Offline

#8 2005-04-09 16:21:39

eerok
Member
From: Canada
Registered: 2005-03-20
Posts: 171

Re: Transfer system to another hard disk

I regularly use a similar method to do simple backups.  You have the right idea -- if the system isn't live, you don't have to worry about the pseudo filesystems like /proc.

Remember when you copy back to designate a wildcard, for example as in:

cp -a /mnt/backup/* /mnt/fresh

Otherwise your root fs will end up under "/backup" ... (I actually made this mistake once, lol.)

Also, you can go from ext3 to reiser with no problems.

When you're done the system should just boot as always.


noobus in perpetuus

Offline

#9 2005-04-09 17:14:43

mico
Member
From: Slovenia
Registered: 2004-02-08
Posts: 247

Re: Transfer system to another hard disk

Great, that ext3 is starting to annoy me. I chose ext3 just to see for myself how it looks like, although I've always used reiserfs on other installs.

That mistake with the wilcard is really funny, thanks for pointing it out, I hope I'll remember not to make it myself smile  although it's probably quick to repair, just move files to /

Offline

#10 2005-04-10 00:15:09

iphitus
Forum Fellow
From: Melbourne, Australia
Registered: 2004-10-09
Posts: 4,927

Re: Transfer system to another hard disk

i went from ext3 to reiser4 by copying big_smile

Offline

#11 2005-04-11 21:32:12

mico
Member
From: Slovenia
Registered: 2004-02-08
Posts: 247

Re: Transfer system to another hard disk

I bought a new disk today. It wasn't as expensive as I feared, 75€ for 40 GB Samsung with FDB and 8 MB cache.

Anyway, I wanted to say I found another proof of how great linux is. BIOS recognized only 8 GB, but linux (or parted, I wouldn't know which one gets the credits for this) corrected this fault of my ancient BIOS and my ancient laptop and automatically set things right smile
I thought this is impossible without a bios upgrade. Other not free (although a bit old) partitioning software I have could not do that, they all reported a 8 GB disk.

I had some troubles with nfs, though. It was painfully slow and when I wanted to abort copying I couldn't kill cp. I noticed this problem with other programs when using nfs some time ago. Looks like this very annoying bug (or is it a feature wink ) is still present. I don't see why any process besides init should have this immunity.

Funny thing is, when I swithed the roles of nfs client and nfs server, I got properly high LAN speeds and the system transfer finished successfully big_smile

Offline

#12 2005-04-12 02:33:41

iphitus
Forum Fellow
From: Melbourne, Australia
Registered: 2004-10-09
Posts: 4,927

Re: Transfer system to another hard disk

killall -9 cp
will kill cp without a problem

Offline

#13 2005-04-12 09:51:58

mico
Member
From: Slovenia
Registered: 2004-02-08
Posts: 247

Re: Transfer system to another hard disk

No it won't. That's what I meant, it couldn't be killed at all. Same can happen with some other processes when using nfs. You try to kill it with kill -9 as root, kill exits with no output (no errors), but the process won't die. I experienced this only when using nfs.

Offline

#14 2005-04-12 09:58:49

cactus
Taco Eater
From: t͈̫̹ͨa͖͕͎̱͈ͨ͆ć̥̖̝o̫̫̼s͈̭̱̞͍̃!̰
Registered: 2004-05-25
Posts: 4,622
Website

Re: Transfer system to another hard disk

yeah, I believe some processes descend into kernel space, and can no longer be trapped (ie killed). Also, it may seem like a process is not being killed, and might be that the parent has been killed, and the child languishes in a pseudo-state until it gives up the ghost.


"Be conservative in what you send; be liberal in what you accept." -- Postel's Law
"tacos" -- Cactus' Law
"t̥͍͎̪̪͗a̴̻̩͈͚ͨc̠o̩̙͈ͫͅs͙͎̙͊ ͔͇̫̜t͎̳̀a̜̞̗ͩc̗͍͚o̲̯̿s̖̣̤̙͌ ̖̜̈ț̰̫͓ạ̪͖̳c̲͎͕̰̯̃̈o͉ͅs̪ͪ ̜̻̖̜͕" -- -̖͚̫̙̓-̺̠͇ͤ̃ ̜̪̜ͯZ͔̗̭̞ͪA̝͈̙͖̩L͉̠̺͓G̙̞̦͖O̳̗͍

Offline

Board footer

Powered by FluxBB