LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Kernel (https://www.linuxquestions.org/questions/linux-kernel-70/)
-   -   Copy boot partition to smaller partition (https://www.linuxquestions.org/questions/linux-kernel-70/copy-boot-partition-to-smaller-partition-518251/)

Quakeboy02 01-10-2007 11:34 PM

Copy boot partition to smaller partition
 
I've found several threads about copying the boot partition to a larger partition but not for copying to a smaller partition. Ignoring the why of the question, could anyone point me to how? Following the guide to "dd" thread only left me with a partition with a corrupted superblock and no real way to fix it. This is what I tried:
Code:

dd if=/dev/hda1 of=/dev/hdb1 bs=4096 conv=noerror

syg00 01-10-2007 11:56 PM

Just use "cp -a ..." - IMHO "dd" is not a good way to copy partitions. You've discovered one of the reasons.
You will need to re-install the boot-loader and update fstab (if you mount /boot).

Quakeboy02 01-11-2007 12:13 AM

"Just use "cp -a ..." - IMHO "dd" is not a good way to copy partitions. You've discovered one of the reasons."

I'm giving this a try as I type this as "cp -a / /mnt". However, since /mnt falls under "/", I expect it will fail. So, I'll probably need to do this from a liveCD, right? The disk already has an MBR, I think, from my previous disastrous exploits. :) Will I need to do anything special to make it bootable, or are you saying that I just need to install grub? I'm kinda lost on that point.

Quakeboy02 01-11-2007 01:44 AM

Mission accomplished! Thanks for the help!

Added:
I did have a couple of problems, and maybe someone's search will lead them to this thread.

Boot message "waiting on root filesystem" - was caused by forgetting to rejumper the drive to master after the copy.

The new motherboard has 2 ethernet ports vs one on the old one. Udev assigned both to eth0.

For some reason, udev reassigned my wireless card to ath1.

Both udev problems were fixed by editing:
/etc/udev/rules.d/z25_persistent-net.rules

Forgot to add "sata_nv" to my kernel before doing the copy, so I had no "/data" drive and thus no kernel source (I keep it on /data). Fortunately, it was easy enough to do an nfs copy of the source from one machine to the other and recompile with SATA turned on.


All times are GMT -5. The time now is 11:55 PM.