I need a little help from a GRUB expert.
I just cloned a 1 TB Seagate drive onto a brand new 2 TB Hitachi, and before swapping them out, I decided to boot-test it. It's tied to my computer through a SATA 2 to USB adapter. The 25-hour cloning operation seems to have worked fine; I used dd piped through pv.
However, when I boot, I now get a message from GRUB2 saying that the partition is not found; then get dumped to the grub rescue prompt.
ls gives me a one-partition drive on hd0 (not sure what this is, possibly a thumb drive), a sequence of partitions on hd1, and a single-partition on hd2 (again, no idea what this is). (hd1,msdos10) seems to be a non-bootable partition that I keep around; most of the others (those on an ext file system) are recognized. I find my Ubuntu Trusty Tahr root on (hd1,msdos5). However, even after "set root=(hd1,msdos5)", all attempts at insmod ("insmod normal") and ("insmod linux") return "Partition not found".
I'm guessing that the MBR of my new drive is not relevant to the partitions cloned onto it. What I'm not sure of is how to fix that. Again, the target drive is mounted externally (even though it's ultimately an internal drive); and I can boot to a LiveUSB or hda, but not it. It has a Windows 7 partition, Ubuntu 14.04, and a sequence of additional partitions inclusive of Windows Recovery/Repair/Whatever-They're-Calling-It, my extra partition at the end, my home partition, swap, and probably one or two other guys like temp.
In the worst case, I suppose I could reinstall all of Ubuntu 14.04, but that would require a lot of further time prying through the repos to get all my old stuff back. I'm sure this is simple, but the MBR is not the kind of thing I screw around with unless absolutely necessary, especially when I don't know what I'm doing and it's a potential 25-hour fix!
Quoted terminal output from GRUB:
ls
> (hd0) (hd0,msdos3) (hd0,msdos2) (hd0,msdos1) (hd1) (hd1,msdos11) (hd1,msdos10) (hd1,msdos9) (hd1,msdos8) (hd1,msdos7) (hd1,msdos6) (hd1,msdos5) (hd1,msdos3) (hd1,msdos2) (hd1,msdos1) (hd2) (hd2,msdos1)
ls (hd0,1)
> Filesystem is unknown
ls (hd0,msdos1)
> Filesystem is unknown
set root=(hd1,msdos5)
insmod normal
> Partition not found
...
It sounds as though the new drive doesn't have the correct partitioning - if you're only seeing one. Did you pass the dd command '/dev/sdn' or '/dev'sdn1' to write to?I think your first task now is to remove the new drive, and see if you need to undo the MBR 'fix' - if so, there are several questions about that here with answers such as this.
Once you have a working system, you get to 'how to do this right':
Backup is good - you probably don't need reminding just now :)
I would start this from a live CD boot, for starters, as a live system may well change whilst being written - in fact almost certainly will.
First, check where your old drive (source) is, then plug the new drive in, check where it went as the drive designation can vary -
dmesg | tail
ormount
will do (but mount, only if the filesystem recognises it - I doubt yours will right now), orfdisk -l
but care is needed to get them right. This is a crucial point!Once you know which is which, you can do the copy;
dd if=/dev/sdx of=/dev/sdy
- note you do NOT use the partition numbers.You can use
pv
but IMHO this complicates things if you're having trouble, you already know it takes ages. It will go a LOT faster if you plug the drives in directly.You should end up with 2 drives the same, one having 50% unallocated space. Disconnect the new one, reboot to ensure all is well. This is not technically necessary, but I would..
Turn off, plug in the new drive - direct or do the USB thing again if you prefer. Reboot. If it won't boot, your PC is allocating /dev/sda to the new drive, so using USB may be a good plan now.
At this stage you can use
gparted
to enlarge existing partitions, or fdisk to add a new one. Once done, you can swap drives and try a boot; you may need to go back to the top of this & try the link I gave to fix booting, depending what you changed.