Repair Superblock

I'm transferring my linux system from a 1GB drive to a 4GB drive.  It seems to have gone well for the most part, but I'm encountering an error upon booting from the new drive.  First, some background on how I did the transfer.

First I created 3 partitions proportional in size to the three on the old drive: one for /boot, one for / and a swap.  I then copied over the MBR from the old drive (hda) to the new drive (hdb): dd if=/dev/hda of=/dev/hdb bs=446 count=1.  Then, I used dd again to copy each data partition separately.  Finally, I used mkswap to initialize my swap space.

So I've got my new drive will all of the data and ready to boot.  But when it boots up, it complains about an invalid superblock for the /boot partition (hda1).  Since I copied everything over exactly, this is where the problem is coming from, but how can I set the superblock to something valid for the new sizes?  Obviously I don't have a legitimate backup at 8193; I don't have a legitimate backup anywhere.  Is there a way that I can create my own superblock from scratch and apply it?  Any other solutions?

Thanks in advance.
ArtineAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

chetankultheCommented:
Hello Artine,

You can use  HDD clone making software it will take care of everything,you can found it from :-
http://www.powerquest.com/drivecopy/ 


Chetan K Kulthe
0
chetankultheCommented:
Hello Artine ,
Make a boot disk, you need to boot after the files have been transferred
Install the new drive on a second slot, boot, and partition the drive the same
as the old one (sizes can vary)
Create the file system on the new partitions

Log in as root and move to / directory
Make a list of all the directories to copy by issuing:  ls | grep -v proc >
/root/files
 (As the proc does not exist we can exclude it)

Make a mount point for the new drive
Go to single user mode with init 1
Mount the new drive to the mount point you created
If you are still in / copy the files with tar cf - `cat/root/files` |
(cd/newdrive;tar xvpf -)
Take out the old drive and put the new one into the old drives port and reboot
using boot disk and run lilo
I think this about does it.

---------------------------------
-Chetan K Kulthe
---------------------------------

0
jlevieCommented:
dd can only be used to transfer a system if the old and new partitions are the same size. It sounds like that's not the case here and you need to use a backup/restore procedure to move the system. The process looks like:

1) Use fdisk to make partitions on the new drive, marking all except the swap partition as type "linux". Mark the swap as "linux swap". If the existing /etc/fstab mounts file systems by label you'll need to include "-L volume-label" in the mke2fs command. Also if you have ext3 support in your kernel you'll want to include "-j" in the options (e.g 'mke2fs -j -L /boot /dev/hdb1').

2) Make a file system (mke2fs) on each linux partition and make swap (mkswap) on the linux swap.

3) Make a temp mount point (mkdir /mnt/disk) and then for each file system (except swap) on the old disk do:

mount /dev/hdbN /mnt/disk
cd /mnt/disk
dump 0af - /dev/hdaN | restore rvf -
cd /
umount /mnt/disk

changing hdbN/hdaN as appropriate.

4) Move the new disk to Primary IDE Master, boot up with a boot floopy or CD in rescue mode, and install a bootloader ('lilo' or 'grub-install').
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Linux

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.