Solved

Repair Superblock

Posted on 2003-11-28
3
4,242 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
Comment Utility
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
Comment Utility
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
Comment Utility
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 Gift Card with Acronis Backup Purchase!

Backup any data in any location: local and remote systems, physical and virtual servers, private and public clouds, Macs and PCs, tablets and mobile devices, & more! For limited time only, buy any Acronis backup products and get a FREE Amazon/Best Buy gift card worth up to $200!

Join & Write a Comment

Introduction We as admins face situation where we need to redirect websites to another. This may be required as a part of an upgrade keeping the old URL but website should be served from new URL. This document would brief you on different ways ca…
It’s 2016. Password authentication should be dead — or at least close to dying. But, unfortunately, it has not traversed Quagga stage yet. Using password authentication is like laundering hotel guest linens with a washboard — it’s Passé.
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.

762 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

10 Experts available now in Live!

Get 1:1 Help Now