Solved

Repair Superblock

Posted on 2003-11-28
3
4,257 Views
Last Modified: 2007-12-19
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.
0
Comment
Question by:Artine
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 

Expert Comment

by:chetankulthe
ID: 9841415
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
 

Expert Comment

by:chetankulthe
ID: 9841451
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
 
LVL 40

Accepted Solution

by:
jlevie earned 250 total points
ID: 9842481
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

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I. Introduction There's an interesting discussion going on now in an Experts Exchange Group — Attachments with no extension (http://www.experts-exchange.com/discussions/210281/Attachments-with-no-extension.html). This reminded me of questions tha…
The purpose of this article is to demonstrate how we can use conditional statements using Python.
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.
Suggested Courses

740 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question