LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel
User Name
Password
Linux - Kernel This forum is for all discussion relating to the Linux kernel.

Notices



Reply
 
Search this Thread
Old 01-11-2007, 12:34 AM   #1
Quakeboy02
Senior Member
 
Registered: Nov 2006
Distribution: Debian Squeeze 2.6.32.9 SMP AMD64
Posts: 3,245

Rep: Reputation: 121Reputation: 121
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
 
Old 01-11-2007, 12:56 AM   #2
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 12,500

Rep: Reputation: 1077Reputation: 1077Reputation: 1077Reputation: 1077Reputation: 1077Reputation: 1077Reputation: 1077Reputation: 1077
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).
 
Old 01-11-2007, 01:13 AM   #3
Quakeboy02
Senior Member
 
Registered: Nov 2006
Distribution: Debian Squeeze 2.6.32.9 SMP AMD64
Posts: 3,245

Original Poster
Rep: Reputation: 121Reputation: 121
"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.
 
Old 01-11-2007, 02:44 AM   #4
Quakeboy02
Senior Member
 
Registered: Nov 2006
Distribution: Debian Squeeze 2.6.32.9 SMP AMD64
Posts: 3,245

Original Poster
Rep: Reputation: 121Reputation: 121
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.

Last edited by Quakeboy02; 01-11-2007 at 08:30 PM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Messed up partition table and Windows' partition boot sector pyromithrandir Linux - General 32 04-08-2006 01:26 PM
Copy files from partition to partition too slow, SATA hard disk.What should I do£¿ Ryanlee Suse/Novell 20 10-31-2005 08:30 AM
PARTIMAGE, restoring to bigger/smaller partition max_mad Linux - General 12 10-04-2005 08:51 PM
What is the code to copy a file from my windows partition to my linux partition? THEBIGFISH Linux - Newbie 3 03-15-2004 11:14 PM
strange partition table - boot partition empty etanter Linux - General 0 12-23-2003 10:46 AM


All times are GMT -5. The time now is 03:12 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration