LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This 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!

Notices


Reply
  Search this Thread
Old 10-27-2010, 01:27 AM   #1
tonyawards
LQ Newbie
 
Registered: Jun 2008
Distribution: Sabayon
Posts: 15

Rep: Reputation: 1
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:


Quote:
dd if=/dev/sda of=/dev/sdb bs=4096 conv=notrunc,noerror
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:


Quote:
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):


Quote:
detected real_root
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:


Quote:
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.
 
Old 10-27-2010, 03:25 PM   #2
business_kid
LQ Guru
 
Registered: Jan 2006
Location: Ireland
Distribution: Slackware & Android
Posts: 7,579

Rep: Reputation: 698Reputation: 698Reputation: 698Reputation: 698Reputation: 698Reputation: 698
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.
 
Old 10-27-2010, 05:29 PM   #3
jefro
Moderator
 
Registered: Mar 2008
Posts: 15,388

Rep: Reputation: 2199Reputation: 2199Reputation: 2199Reputation: 2199Reputation: 2199Reputation: 2199Reputation: 2199Reputation: 2199Reputation: 2199Reputation: 2199Reputation: 2199
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.

(I assume it to be last, vice least,)
.
 
Old 10-27-2010, 09:32 PM   #4
tonyawards
LQ Newbie
 
Registered: Jun 2008
Distribution: Sabayon
Posts: 15

Original Poster
Rep: Reputation: 1
Thanks for the prompt replies.


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?
 
Old 10-28-2010, 09:19 AM   #5
business_kid
LQ Guru
 
Registered: Jan 2006
Location: Ireland
Distribution: Slackware & Android
Posts: 7,579

Rep: Reputation: 698Reputation: 698Reputation: 698Reputation: 698Reputation: 698Reputation: 698
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
 
Old 11-01-2010, 11:28 PM   #6
tonyawards
LQ Newbie
 
Registered: Jun 2008
Distribution: Sabayon
Posts: 15

Original Poster
Rep: Reputation: 1
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...
 
Old 11-02-2010, 04:24 AM   #7
business_kid
LQ Guru
 
Registered: Jan 2006
Location: Ireland
Distribution: Slackware & Android
Posts: 7,579

Rep: Reputation: 698Reputation: 698Reputation: 698Reputation: 698Reputation: 698Reputation: 698
Guess who has that particular tee-shirt? :-)
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Clone a dual booting IDE hard drive to a SATA hard drive namida12 Linux - Distributions 1 07-14-2008 11:01 AM
problem with "screen" Cannot access '/newroot/dev/pts/0' - in a chroot - not /newroot stardotstar Linux - Software 0 05-01-2008 06:12 PM
Mounting root filesystem from an external USB hard drive? ChrisHart Linux - Laptop and Netbook 6 04-02-2005 11:49 PM
How to copy ext2fs from failed hard drive to good drive? DogWalker Linux - Hardware 2 08-30-2004 11:52 PM
Troubles with mounting hard-drive. Cannot even mount or access in root. eBopBob Linux - Hardware 4 08-19-2004 07:09 AM


All times are GMT -5. The time now is 10:27 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration