?
Solved

Repair Superblock

Posted on 2003-11-28
3
Medium Priority
?
4,277 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 1000 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

Fill in the form and get your FREE NFR key NOW!

Veeam® is happy to provide a FREE NFR server license to certified engineers, trainers, and bloggers.  It allows for the non‑production use of Veeam Agent for Microsoft Windows. This license is valid for five workstations and two servers.

Question has a verified solution.

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

You ever wonder how to backup Linux system files just like Windows System Restore?  Well you can use Timeshift in Linux to perform those similar action.  This tutorial will show you how to backup your system files and keep regular intervals. Note…
Fine Tune your automatic Updates for Ubuntu / Debian
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial
Suggested Courses

649 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