PDA

View Full Version : Proper way of moving to new disk?



fribert
21-Apr-2014, 10:18
I have a SLES 11 that has been upgraded a few times, so the root/boot/var-log is on one partition, and the filesystem is reiserfs.
What's the best way of moving it to a new disk, split up into /boot and / and /var-log and convert it to ext2/3 at the same time?
I've tried a few things
cp -ax yada yada to the new disks
mount the new disk and mount -B the /dev, then chroot the new disk
Then mount /boot
Finally grub-install
It says it installs the grub successfully, but when I boot it just sits there.
Btw. I also changed the fstab so that it uses UUID's of the new disk.

jmozdzen
22-Apr-2014, 15:15
Hi tribert,

there is probably more than one way to do this, but my recommendation would be to move to LVM during that step. That way, future moves could be done "hot" by live moving from one PV to another.

What was the starting point of your migration - did you boot to a recovery system (DVD/USB drive/...) or did you do this from within a running system?

Rather than using "cp", I'd opt to using "tar" to copy the actual files.

After copying the files, before installing grub, I'd remove the old disk. Not only to be sure you still have a working old system, but to make sure that grub-install sees the same device(s) as after the migration, to add the boot record to the proper disk.

Or do you want to have both disks installed, even after the migration?

> but when I boot it just sits there.

Is the original disk still installed and containing the original files? Did you set your BIOS to boot from the new disk?
Regards,
Jens

fribert
22-Apr-2014, 17:00
Hi Jens
I was doing this from a rescue system, as I don't think I would get everything over in a running system.
Why the tar? better preservation of owner/attribs, or? What command would you suggest?
So after copying, boot up on the rescue system with the old disk disconnected?
It's a vmware, so no, I don't need the old disk available.
I set it up to use the new disk, the old disk was removed, but it just sat there...
So boot in the rescue system, fix the fstab on the new disk, and then install grub with what command on Sles?

jmozdzen
22-Apr-2014, 23:37
Hi fribert,

Hi Jens
I was doing this from a rescue system, as I don't think I would get everything over in a running system.
Why the tar? better preservation of owner/attribs, or? What command would you suggest?
the "tar" command is pretty sophisticated when it comes to handling special files, too (symlinks, device files etc).


So after copying, boot up on the rescue system with the old disk disconnected?
It's a vmware, so no, I don't need the old disk available.
I set it up to use the new disk, the old disk was removed, but it just sat there...

If you have only the new disk attached, boot via rescue system and re-run the grub install (i.e. mount disk et al. to /mnt, chroot /mnt, yast2 bootloader). (We switched from VMware to Xen ages ago and are running parav's ever since... no need for a boot loader on the virtual disk, so YMMV :[ )

Regards,
Jens

fribert
23-Apr-2014, 09:18
Thanks, I found a tar command like this: tar cf - * | ( cd /target; tar xfp -)
That will copy the current dir to the /target, I hope that will take enough with it :-)
When it's done, I'll try the yast bootloader on the chroot environment

fribert
23-Apr-2014, 10:39
Now it boots at least.
I'm trying to go from a reiserfs filesystem to an ext3 filesystem on root.
When I boot it now says that


fsck: fsck.ext3: not found
fsck: Error 2 while executing fsck.ext for /dev/sda4
fsck failed. Mount root device read-only.
Mounting root /dev/sda4
mount -o ro,acl,user_xattr -t ext3 /dev/sda4 /root
mount: unknown filesystem type 'ext3'
could not mount root filesystem -- exiting to /bin/sh
$
Not really sure where to go from here?

jmozdzen
23-Apr-2014, 11:07
Hi fribert,

Now it boots at least.
I'm trying to go from a reiserfs filesystem to an ext3 filesystem on root.
When I boot it now says that


fsck: fsck.ext3: not found
fsck: Error 2 while executing fsck.ext for /dev/sda4
fsck failed. Mount root device read-only.
Mounting root /dev/sda4
mount -o ro,acl,user_xattr -t ext3 /dev/sda4 /root
mount: unknown filesystem type 'ext3'
could not mount root filesystem -- exiting to /bin/sh
$
Not really sure where to go from here?

ups - at least your initial ram disk (initrd) is missing the ext3 tools, probably because it determined during the last run, that your rootfs is Reiser... which it now isn't.

Have you already tried to run the repair system (boot from the SLES DVD and select the repair option)? Of course, you might as well run things manually, i.e. "recovery system", mount rootfs (+ /sys, /dev with -o bind, /tmp, /var, if on separate file systems), chroot, mkinitrd - but there are some pitfalls (like detecting the proper root device) that might be avoidable via the repair system.

Regards,
Jens

fribert
23-Apr-2014, 11:15
Yes, I tried the repair system, that made a mess of my grub config.
I think I'll try and fix the grub config and see if it works...

fribert
23-Apr-2014, 11:32
Nope, the repair system didn't work.
So
mount /dev/sda4 /mnt (the root partition)
mount -B /dev /mnt/dev
mount -B /sys /mnt/sys
mount -B /proc /mnt/proc
chroot /mnt
mount /dev/sda2 /boot
mount /dev/sda3 /var/log
mkinitrd

now it boots :-o

fribert
23-Apr-2014, 12:46
Darned, I can't make the other server work properly, that just says 'booting' but nothing happens.
I've tried doing the chroot routine, and then yast bootloader
Rewrite the bootloader
But that doesn't help

fribert
23-Apr-2014, 12:52
I also tried the repair, that didnt' do it either, odd...

fribert
23-Apr-2014, 13:40
Ok, tried it again, doing the chroot, yast bootloader, going to Bootloader install, going through the configs, making it write the bootloader, and now it boots :D Wehee.

jmozdzen
23-Apr-2014, 16:46
Hi fribert,

great to see you got it working - and good to see I didn't have to guide you through the manual initrd creation via chroot, which you did all by yourself :)

Best regards,
Jens

fribert
23-Apr-2014, 17:08
Thanks :)
Learning all the time, good to see that it's possible to 'convert' reiserfs that way, and I now know a good way of copying data that perserves most information.
The bootloader thing still seems a bit flakey, I had to go over that several times, but it helps to know that you're on the right track.
Oh, and mkinitrd, yes, working with vmware and suse you get to know pretty quick how to do that :rolleyes:, though it has gotten a lot better in the later versions.