Linux - SoftwareThis forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.
Notices
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.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I lost my partition table (at least I hope it's only the table and the data is still there) - most probably during a reset after my system crashed...
So I did not create any partitions or format anything - the data should still be on the disk, right? It is a 300GB disk containing one primary ext3 partition.
gpart: scanned the disk for like an hour and didn't find anything but "unused space".
fdisk: 'fdisk -l' tells me "Disk /dev/hdg doesn't contain a valid partition table". Starting 'fdisk /dev/hdg' gives me some output - amoung others "Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)". Writing the partition table does not seem to correct this - the same error occurs every time I start fdisk.
hdparm: 'hdparm /dev/hdg' gives me a correct output of the disks geometry - so it still works properly I hope.
Not 100% sure but I think parted gives some options to recover partiton tables, It should be well worth a try...
Hm, just tried 'parted /dev/hdg' and then 'print', which gives me "Error: unable to open /dev/hdg - unrecognised disk label". The same output for the 'rescue' option...
I thought it might be a good idea to create a new disk label (partition table), so typed 'mklabel msdos'. No report (which hopefully means no problem), but still the same error message when I want to print the partition table after that...
Seems to be a good tool! But also seems there is some more severe problem with my disk!?
Anyone: can clearing the MBR and then re-adding a partition table help??
I used parted last week and it does take a bit of getting used to, I will search around for some web help and post if I find anything further. Don't give up just yet and I would recomend doing some web searches on recovered disks with parted etc.. You might turn up something very helpful.
I don't know if this will help, but if you kill your partition table (without reformatting, etc) then Yes, you can recover your data. In order to do so however, you need to recreate the same partitions, using the same sizes as they were previously. Obviously, this may be easier said than done, and if you don't know what exact sizes they were in the past, it might not be possible.
However, thinking optimistically, if you know that (for example) hda1 was swap and it was 512Mg, and that hda2 was root and was 50G, and that hda3 was /home and was the rest of the drive, then if you just redefine those partitions, you should be up and running. FWIW, I've found myself in this exact situation more than once, but fortunately I had written up some notes about my system so I was able to recover.
Good luck with it. There are a number of other existing threads on this topic; check them out if you haven't already for other suggestions
If there was just the one partition on it, use fdisk to create a partition. Take all the defaults - start at the start, use the whole disk.
Doesn't matter if it winds up bigger than you had before - the filesystem will be intact and usable so long as your previous partition was at the beginning of the disk. As it will almost certainly have been.
If there was just the one partition on it, use fdisk to create a partition. Take all the defaults - start at the start, use the whole disk.
That's what I was hoping all the time - and I was sure to be able to simple re-create that one partition (without formating).
But then all the time (using both fdisk and parted) I received the message that my partition table was corrupt (see my post #2 - post #3 all together in this thread) and couldn't even make an empty new one. And without a partition table - of course - you can not create a partition...
For whatever reason today I could?!?!?!?
So now I could create an ext3 partition using the whole drive and... TA-DA... I can do an 'fsck /dev/hdg1', which means it is there and currently checking the file system!!
So - I have no idea what is different today!! But it works... thanks all!
I have noticed this in the past when using parted and "fdisk -l" updates are not displayed till a full reboot is completed, This can be a bit of a pain for me as I always forget and my laptop always fails to boot with external devices connected! D'Oh!
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.