Moving my Debian installation to another drive...

Chaotic42

Lifer
Jun 15, 2001
34,874
2,036
126
I'm running into problems. I've got grub setup, I tar-ed everything over. All of the files seem to be there, but I can't log in on the new partition. When it gets to starting runlevel 2, it just goes to the login, which says that /dev/tty1 is readonly. It then moves back to the login screen.

What am I doing wrong?
 

drag

Elite Member
Jul 4, 2002
8,708
0
0
maybe the permissions are getting fouled up.

try booting up with a live linux cd and then use the "cp --archive" command to copy everything over. Just a regular tar command will foul up symbolic links and permissions, you can tar, but you will have to use switches to preserve permissions, links and other special files like the /dev file.

I used cp --archive to move my debian install around different partitions and it works fine.
 

Olias

Senior member
Sep 3, 2000
529
0
0
I used the 'cp -ax' command and it worked. Here's what I did...

1. Installed the new harddrive as hdd.
2. Booted with the a Knoppix Live CD.
3. Made new partitions and formated them.
4. mkdir for /mnt/new and /mnt/old
5. Mount old and new root partitions to respective mount points.
6. cp -ax /mnt/old/your_dir/* /mnt/new
7. Umount both partitions.
8. Mount old and new boot partitions to respective mount points.
9. cp -ax /mnt/old/* /mnt/new
At this point I unmounted stuff and pulled out the old drive as well as made the new drive hda
10. Rebooted from the Live CD and ran grub to install on MBR of new drive.
11. Reboot
I didn't bother copping the /boot, /dev, /home, /mnt, /proc and /sys directories from the root partition but rather just mkdir for those. This is because my /boot and /home are on different partitions. Also, mkdir your mount points in /mnt but beware that if you copy /mnt that you will be also copping all that's mounted there.

Good luck. It's not too differcult.
 

n0cmonkey

Elite Member
Jun 10, 2001
42,936
1
0
cp -p usually keeps the permissions I think. Also tar -xvpf file.tar should keep the permissions also.

You'd know that if you read my netboot how-to ;)

:p
 

drag

Elite Member
Jul 4, 2002
8,708
0
0
I don't like using the mv command for anything important. It deletes files as they are copied and basicly you only get one chance to get it right.


Better to use "cp --archive". it's the same as going "cp -a" or "cp -dpR". It preserves timestamps, links, and copies recursively.

I'd only use tar command if I am backing up stuff for storage, or am going to transfer large amount of files over the network.

Then after everything is copied, check the new root file system and make sure that everything is keen.

For instance if you have the old one mounted at /mnt/old and the new one mounted at /mnt/new, you can go like this:

ls -alR /mnt/old > cow
ls -alR /mnt/new > cow2

then:

diff cow cow2 > cow.log

That will show any differences in time stamps, sizes, links or file permission/ownerships.

I did this when I repartitioned my debian system, and the only differences were the file sizes on the directories since I switched over to XFS and it handles directories slightly differently.

It worked for me. But mv is dangerous, it's been a couple times I lost and corrupted a few hundred megs of data simply (last time was that I blew away something like 40-50 custom maps for quake3 mods that were a pain to find, not to mention a bunch of big .pak files that I had to locate (the cdrom took a couple days to find) and copy off of the cdrom again.) because something happened in the file transfer and it got interrupted, or the file system ran out of room thru braindead actions of myself.
 

n0cmonkey

Elite Member
Jun 10, 2001
42,936
1
0
Originally posted by: drag
I don't like using the mv command for anything important. It deletes files as they are copied and basicly you only get one chance to get it right.


Better to use "cp --archive". it's the same as going "cp -a" or "cp -dpR". It preserves timestamps, links, and copies recursively.


cp -a and cp --archive are gnuisms. I try to stay as platform agnostic as I can (I don't see drive designations as important, since they change from setup to setup anyhow ;)).

I'd only use tar command if I am backing up stuff for storage, or am going to transfer large amount of files over the network.

Then after everything is copied, check the new root file system and make sure that everything is keen.

For instance if you have the old one mounted at /mnt/old and the new one mounted at /mnt/new, you can go like this:

ls -alR /mnt/old > cow
ls -alR /mnt/new > cow2

then:

diff cow cow2 > cow.log

That will show any differences in time stamps, sizes, links or file permission/ownerships.

I did this when I repartitioned my debian system, and the only differences were the file sizes on the directories since I switched over to XFS and it handles directories slightly differently.

It worked for me. But mv is dangerous, it's been a couple times I lost and corrupted a few hundred megs of data simply (last time was that I blew away something like 40-50 custom maps for quake3 mods that were a pain to find, not to mention a bunch of big .pak files that I had to locate (the cdrom took a couple days to find) and copy off of the cdrom again.) because something happened in the file transfer and it got interrupted, or the file system ran out of room thru braindead actions of myself.

I've never had an issue with it as far as I can tell. I might look to see if I can find a Unix standard equivilent of the --archive flag. Other than that, any comments on my quick faq? :p
 

n0cmonkey

Elite Member
Jun 10, 2001
42,936
1
0
Originally posted by: BingBongWongFooey
And you don't need dashes for tar options. ;)

I think it makes it a bit easier to explain. Maybe that's just me though.