You are not logged in.
I have 2 drives for my laptop (60gb laptop internal and a 320gb usb enclosure) which I was in the process of exchanging today (I want the 320gb inside the laptop instad of the 60gb)
To cut a long story short, I had copied (using dd) my archlinux and ubuntu root partitions from the 60gb to the 320gb, it didnt work and for reasons unknown I tried copying the MBR from the 60gb to the 320gb using
dd if=/dev/sda of=/dev/sdb bs=512 count=1
of course, I did not back up the existing sdb MBR >.<
Now the 320gb seems to think it has a corrupt version of the partition table of the 60gb.
The crux of my question; is there a way to rebuild the partition table of the 320gb drive? it has not been written on since breaking the MBR.
This morning I partitioned it using gparted; it was originaly one ext3 data partition (sdb1) taking 100% of space, which I then shrank and moved to the right by 20gb and created 2gb swap (sdb2) 10gb arch partition (sdb3) and 8gb ubuntu partition (sdb4) to sdb1's left.
I am only interested in recovering the data from sdb1. I can write it to my desktop if need be but ideally I would like to rebuild the partition table.
Maybe i'm being overly optimistic here, but i have a feeling that if i used fdisk to re-write the exact partition table - all would be well again??
The trouble with this method is that i partitioned using gparted entering round numbers (ie create sdb2 2000mb, sdb3 10000mb, sdb4 100% of remaining space) but those numbers get rounded up/down to fit on the tracks/sectors - correct?
If I were to delete the current partitions and re-create in the same order with gparted, would it work? or would gparted format them aswell?
Or, can someone reccomend a good ext3 recovery tool? i tried some windows apps on my desktop but none supported ext3.
here is the output of fdisk -l (it does not display the 60gb, sda - despite it being mounted and working fine)
$ fdisk -l
Cannot open /dev/sda
Warning: ignoring extra data in partition table 5
Warning: ignoring extra data in partition table 5
Warning: ignoring extra data in partition table 5
Warning: invalid flag 0x223e of partition table 5 will be corrected by w(rite)
Disk /dev/sdb: 320.0 GB, 320072933376 bytes
255 heads, 63 sectors/track, 38913 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x73f48d83
Device Boot Start End Blocks Id System
/dev/sdb1 1 313 2514141 82 Linux swap / Solaris
/dev/sdb2 * 314 1259 7598745 83 Linux
/dev/sdb4 1260 7296 48492202+ 5 Extended
/dev/sdb5 ? 43403 142729 797836270+ e1 DOS access
Thanks,
Tom
Offline
For next time, here is how I move an install of linux about:
1. Partition the new drive
2. use cp -R to copy all files across
3. install grub onto the new drive
4. update fstab if the partition order has changed, or if uuids are used.
dd does not work every time. I did know why, but I've forgotten.
As is, it should be possible to recover your partition table by looking at the partitions themselves, and working out where they start. I have seen software to do this, let me see if I can find it.
Jack
Offline
Have a look at gpart. It should be able to guess where your partitions were, and write a new partition table. It isn't always right, make sure what is says is sensible before writing it.
Provided nothing has been written to the drive since the mbr got nuked, that should make is useable.
HTH
Jack
Offline
Thank you Jack! gpart seems to have done the trick
sweet relief
I'm curious, why do you use cp -R? cp -a may be more suitable.
I found the post by SilverBear2006 in this thread quite interesting, comparing dd with cp -a:
http://www.linuxquestions.org/questions … -dd-636291
Offline
@jetsabel:
You should only use dd if the discs geometry is exactly the same. Otherwise, you would need to calculate every partition size in sector units, and build a correct MBR for the second disc - too much work.
Offline
I'm curious, why do you use cp -R? cp -a may be more suitable.
Probably because I forgot cp -a existed... It is a better choice.
Jack
Offline