[SOLVED] dd copy - hard drive clone fails when mounting root & rootblock - /newroot failed
Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Introduction to Linux - A Hands on Guide
This guide was created as an overview of the Linux Operating System, geared toward new users as an exploration tour and getting started guide, with exercises at the end of each chapter.
For more advanced trainees it can be a desktop reference, and a collection of the base knowledge needed to proceed with system and network administration. This book contains many real life examples derived from the author's experience as a Linux system and network administrator, trainer and consultant. They hope these examples will help you to get a better understanding of the Linux system and that you feel encouraged to try out things on your own.
Click Here to receive this Complete Guide absolutely free.
dd copy - hard drive clone fails when mounting root & rootblock - /newroot failed
I am trying to replace an old, smaller, and dying laptop hard drive with a newer one, using a USB external drive. I first tried cloning disk to disk with Clonezilla, but it failed after cloning my root, swap, and /home directories – it froze when it tried to reinstall grub.
After 2x trying, I switched to dd, which I have never really used (I am fairly new to Linux in general). The actual command I used was:
All seemed ok and after approximately 2 hours my 80GB drive had been cloned onto my new 250GB, with dd giving what appeared to be a satisfactory closure summary.
I tried to mount and access the drive from my external USB enclosure but could not view it, though the data is there, I believe, as the size and bytes show... The error that Dolphin is giving me is:
error - “%” wrong fstype, bad option, bad superblock on /dev/sdb1 Missing codepage or helper program or other error.
When I installed the new drive directly into my laptop, it begins to boot (Sabayon 5.4, 2.6.35 kernel) but almost immediately I get (handwritten down, but this is close):
mounting /dev/sda1 on /newroot failed: input/output error
!! Could not mount specified ROOT, try again
!! Could not find the root block device in .
Please specify another value or: press “ENTER” for the same, type “shell” for a shell, or “q” to skip...
root block device ()::
(and a blinking cursor here)
So, needless to say, 'enter' and 'q' options don't work, and 'shell' gives me:
BusyBox 1. something or other...
/bin/ash: can't access tty: job control turned off
(and another waiting cursor here)
I am assuming that my issue has something to do with grub, and maybe specific UUIDs that don't match (?) but I'm not really certain. I have both Grub Legacy 0.9x and the newer Grub 2 installed (Sabayon is already moving over) but I still boot with Legacy, not with the new 2, as I don't know how to switch, and am not sure if I should yet.
I thought that dd copied bit for bit, and I added the “noerror” just to try to get it all transferred, so I don't know what went wrong exactly, though something seems wrong with grub and the bootloader, I guess...
I have looked around but have not found my same issue so far, so I'm posting here. Any ideas? Do I have to reinstall Grub? Or somehow tell it where to go? If so, how would I do that (newbie here, as I mentioned...), and should I install Grub 1 or 2, or both, or...?
Thanks for any input you may have, and please let me know if you need more info - I'll be more than happy to provide it ASAP.
You have screwed up.
It has copied an 80 Gig drive onto a 250G. You replaced the 250G geometry with the geometry of the 80 gig drive using dd... That would work only if you had a clone of the 80 gig drive.
I would suggest a reinstall on the 250Gig (Chance to update?) unless you want the old system, and simply retrieve your data. It gets messy copying a running system - /proc is the memory, and that definitely doesn't like being copied. /dev is a ramdisk already, which you don't want to copy. If someone tried to copy /dev/zero, he'll run out of space.
If you can access them both, simply cp -a /home/you to the new drive. That should get it.
dd if and of ought to make a clone. Fix the size and go is usually what is needed. If you have errors then you may not be able to use dd.
Maybe a bigger chunk. dd if=/dev/sda of=/dev/sdb bs=32768
From another web page.
1. Prepare new drive partition (fdisk, mkfs)
2. Mount prepared partition to /mnt (something like that):
mount /dev/sda2 /mnt
3. Now, clone our filesystem (man tar)
tar -c –one-file-system “/” | tar -x -C “/mnt/”
4. Least, install grub as described in article
The benefit of that way is You don’t need to boot from another media.
It may or may not make any or enough difference, business kid, but upon reading your reply I realized that I forgot to mention one procedural thing I did do: when I used dd, I did so from my Sabayon Live CD, not from my running system, so hopefully nothing I was copying was mounted. Hopefully.
I did notice that the location for the external drive in Dolphin was, as I recall, /media/home-1, or something very close to that. But I still used the normal dd command in the Live CD terminal. Was that correct, and does that give me any better chance of recovering this drive?
And jefro, can I clone using tar from my live installed system and still avoid the problems that business kid was describing – all I need to reinstall would be Grub? (I'm not really sure how to reinstall Grub, although I guess I can google that). Would I reinstall 1 or 2 or both since Sabayon is transitioning?
I had also thought/hoped that booting from a GParted disk and resizing the partitions to the full 250GB after it was finished would work, or is that not the way to use all the space?
dd if of _does_ make a clone. That's the problem.
When copying an 80 Gig to a 250 Gig with dd, more information is usually stored on the bigger disk. For historical reasons (I'm skipping the lecture here) all the drives report the same density to the bios, and all hard disk controllers lie. The bottom line is that, for example, the /bin/ directory is said to be at offset X after his operation. X is where it was on the 80 gig disk, but not on the 250Gig.
To judge by the error message it can't even find the superblock, never mind the data.
dd if=/media/sda1/* of=/media/sdb1/* might copy the files, with the disks mounted, although cp -a is much safer.
dd if=/dev/sda of=/dev/sdb overwrites the filesystem including the invisible layers
Well, business_kid, sadly you were right. I could not access the drive at all, could not even format it with my OS, until I booted from GParted and wiped it clean. GParted would not even resize it (those superblocks...); I had to kill it. Then did a clean install of Sabayon 5.4 to start fresh. Been rebuilding everything until now.
Thanks for your input - it certainly pointed me in the right directions and saved me a lot of guessing.
Lesson learned, no more cloning to different sized disks, easier that way...