Solved

Repair Superblock

Posted on 2003-11-28
3
4,245 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
  • 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Linux as a middle box 7 64
nagios 1 22
Adding more CPU cores to a Linux VM 5 64
expectj telnet failing 5 26
If you use Debian 6 Squeeze and you are tired of looking at the childish graphical GDM login screen that is used by default, here's an easy way to change it. If you've already tried to change it you've probably discovered that none of the old met…
The purpose of this article is to show how we can create Linux Mint virtual machine using Oracle Virtual Box. To install Linux Mint we have to download the ISO file from its website i.e. http://www.linuxmint.com. Once you open the link you will see …
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.:
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

895 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now