I spent the day trying to downgrade my main Linux box from 500 GB to 200 GB, since I want the 500 GB for my fileserver / PVR and I've only been using 150 GB of it so far.
This turned out to be much more complicated than expected, having to do with the fact that the 200GB drive would be the 3rd PATA device in a machine that only has 1 IDE controller. I thought I could just use a Promise Ultra66 card I inherited from
pphaneuf but it doesn't work in this machine (although it works fine in the machine I took it out of).
I eventually decided to do without my removable IDE drive tray for now, so I took it out and put the 200GB drive in its place. Then I booted up with a LiveCD. Or, that is, I tried. True to form, 5 out of 6 live cd's failed to successfully initialize my screen at all. This, I find, is typical. When it comes to X config, debian-based distros usually guess wrong. Finally my Debain Lenny Install disk booted into a usable state.
I then dd-ed the first 200 GB from the 500 GB drive onto the 200 GB drive, (which took just over 3 hours) and I was hoping I was all set. The plan at that point was to fix the partition table on the 200 GB so it no longer referred to an unused partition larger than it was, and then to mount the copy of the boot and main partitions, go into a chroot, re-grub and see if the sucker would boot.
Well, the first problem was that the live CD I was using doesn't support LVM. Fine, I booted up my regular system since it DOES support LVM, but of course then LVM complained that the volume groups on the new drive had identical names and uuid's to the ones that were already mounted, and refused to let me do anything with any of them. Honestly, I should have anticipated this, but didn't.
As a wild experiment, I rebooted with the 500 GB disabled to see if I could boot from the other. It got as far as trying to mount VolGroup00, and died complaining that it couldn't find it. Not sure why, since it had no trouble finding multiple copies earlier...
Anyway, I have officially give up for the night. I had hoped to manage this simple task in a single day, but its clearly not to be. Tomorrow when I'm not so sleepy I'll see if I can figure out the simplest and fastest way to fix things without having to re-copy partitions.
This turned out to be much more complicated than expected, having to do with the fact that the 200GB drive would be the 3rd PATA device in a machine that only has 1 IDE controller. I thought I could just use a Promise Ultra66 card I inherited from
I eventually decided to do without my removable IDE drive tray for now, so I took it out and put the 200GB drive in its place. Then I booted up with a LiveCD. Or, that is, I tried. True to form, 5 out of 6 live cd's failed to successfully initialize my screen at all. This, I find, is typical. When it comes to X config, debian-based distros usually guess wrong. Finally my Debain Lenny Install disk booted into a usable state.
I then dd-ed the first 200 GB from the 500 GB drive onto the 200 GB drive, (which took just over 3 hours) and I was hoping I was all set. The plan at that point was to fix the partition table on the 200 GB so it no longer referred to an unused partition larger than it was, and then to mount the copy of the boot and main partitions, go into a chroot, re-grub and see if the sucker would boot.
Well, the first problem was that the live CD I was using doesn't support LVM. Fine, I booted up my regular system since it DOES support LVM, but of course then LVM complained that the volume groups on the new drive had identical names and uuid's to the ones that were already mounted, and refused to let me do anything with any of them. Honestly, I should have anticipated this, but didn't.
As a wild experiment, I rebooted with the 500 GB disabled to see if I could boot from the other. It got as far as trying to mount VolGroup00, and died complaining that it couldn't find it. Not sure why, since it had no trouble finding multiple copies earlier...
Anyway, I have officially give up for the night. I had hoped to manage this simple task in a single day, but its clearly not to be. Tomorrow when I'm not so sleepy I'll see if I can figure out the simplest and fastest way to fix things without having to re-copy partitions.
no subject
Date: 2009-03-10 08:31 am (UTC)There are various ways of doing this, but my favourite is to repartition the new disk as I want it to be and then mount each partition somewhere suitable and copying the files with find and cpio:
This has worked well for me in the past and while there may be faster/better solutions I tend to go for the "if it works don't fix it" approach when it comes to things like this. It also has the advantage that you can copy to different file system types and to raid or lvm devices if you should want to.
no subject
Date: 2009-03-10 03:23 pm (UTC)I use a variant of
I also often take the opportunity to install a fresh system, as I'm usually careful to keep as much as possible under /home (symlinking from various places as needed, or having a Subversion repository under /home for the configuration files), but if you've got a tricky system that works, just cpio the whole thing...
no subject
Date: 2009-03-10 03:43 pm (UTC)Installing a fresh system can indeed be a very good thing as you can get rid of a lot of inherited annoyances - and it's a great way to check if you actually know what services you're running and how they're configured ;)
no subject
Date: 2009-03-10 04:26 pm (UTC)no subject
Date: 2009-03-10 04:31 pm (UTC)I used Reiser on my mail server, and once I've solved some problems with its kernel (a project for another day) it'll probably get converted to ext3 (or 4) or xfs.
no subject
Date: 2009-03-10 04:34 pm (UTC)no subject
Date: 2009-03-10 04:40 pm (UTC)no subject
Date: 2009-03-10 04:47 pm (UTC)And even if so, the methods I know for re-grubbing all require you to mount the drive to grub, chroot to the drive's mount point and then run some apps. At that point you're using the rescue disk kernel to run native apps on your to-be-grubbed drive. If the kernel is 32-bit and my apps are all 64-bit, I won't even be able to ls.
Or is there something fundamentally wrong with my understanding?
no subject
Date: 2009-03-10 04:49 pm (UTC)no subject
Date: 2009-03-10 04:49 pm (UTC)no subject
Date: 2009-03-10 04:51 pm (UTC)It may just be the lvm.conf file in the initrd of the boot partition needs tweaking...
no subject
Date: 2009-03-10 04:53 pm (UTC)It might not be super-popular on the "random CDs that happen to be bootable Linux systems", but in the specific "my Linux system is borked, here's a CD that will help me fix it" genre, I'd be surprised if it weren't.
no subject
Date: 2009-03-10 05:02 pm (UTC)On my 64-bit Ubuntu system, they were very clever, and knew Bad Things (tm) could happen, so the "grub" utility is actually 32-bit (and statically linked, too). grub-install also sports a --root-directory to tell it where to work, so you can use the one bundled with the rescue live CD while pointing it at the root of the filesystem you need to fix. I didn't check, but I'd suspect that the core-utils (like "ls") on a 64-bit system would be 32-bit also. I'm not above copying a busybox in there before chrooting either. ;-)
no subject
Date: 2009-03-10 05:52 pm (UTC)no subject
Date: 2009-03-10 06:27 pm (UTC)