LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Hardware (https://www.linuxquestions.org/questions/linux-hardware-18/)
-   -   Partitions have disappeared! (https://www.linuxquestions.org/questions/linux-hardware-18/partitions-have-disappeared-423069/)

PsypherPunk 03-09-2006 02:12 AM

Partitions have disappeared!
 
i woke up this morning to find that all the logical partitions on my second hard drive have vanished! fdisk -l for this drive now turns up:

Code:

Disk /dev/hdb: 163.9 GB, 163928604672 bytes
255 heads, 63 sectors/track, 19929 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

  Device Boot      Start        End      Blocks  Id  System
/dev/hdb1              1        2611    20972826  93  Amoeba
/dev/hdb2            2612        7833    41945715  93  Amoeba
/dev/hdb3            7834      19928    97153087+  1f  Unknown
/dev/hdb4          19929      19929        8032+  e  W95 FAT16 (LBA)

However, prior to shutting down last night hdb4 didn't exist and hdb3 was an extended partition containing hdb5-9 (and several distros!). Thankfully there was nothing particularly important on any of the partitions but what's happened!?

Is there any way to recover the data?

J.W. 03-09-2006 03:23 AM

Can you describe what kind of work was being done on the machine immeidately prior to this morning? Were you making any system changes and/or installing a new distro and/or doing partitioning work last night? Does anyone else use this same machine, and could he/she have made some changes? Overall, it seems fairly unlikely that some sort of random system problem would happen to target one specific partition and mess with it. Similarly, if it's a hardware issue such as a dying drive, you'd probably be seeing a lot more other random misbehavior such as unusual clicking noises, etc.

Anyway from your description, it sounds like the issue could have been the result of installing a new distro, and letting an automatic partitioner tool decide how to partition the drive. For machines that already contain other Linux installations, that's always a risky move, and I would recommend only choosing the Manual partitioning option in that scenario. (Obviously this is just speculation on my part.)

In terms of recovering the data, as long as hdb3 has not been reformatted, you could try using a tool such as cfdisk to repartition the space but in my experience the success of such an attempt will depend on recreating the *exact* same partitioning layout as you had before (meaning each re-created partition must use the same starting and ending cylinder number as before) If you redefine each partition just as it was in the past, you have a pretty decent chance of making a recovery. Good luck with it in any case

PsypherPunk 03-09-2006 03:34 AM

i *did* install Windows 98 on a partition (hda2) earlier yesterday. However, the machine had been rebooted several times after this (including a complete power-down) and i was working in SuSE (email, surfing) before it was shut down for the last time.

Grub was directed at the SuSE 10 partition on hdb6 and was booting normally all evening; only when i came to boot this morning Grub reports an 'Error 22' due to the missing partition.

PsypherPunk 03-09-2006 04:54 AM

i've just spotted something - hdb3 (which was supposed to be an Extended partition in which the other Logical partitions existed) is showing as type '1f' whereas it should be type '5', shouldn't it?

If anyone could confirm this, that'd be great. Or suggest any way to change the type without formatting.

syg00 03-09-2006 05:12 AM

Hmmmm - Suse 10.
You sure you weren't in it's partitioner at any time ????.

All those partition type are invalid - at least they would be in any sane installation.

PsypherPunk 03-09-2006 05:26 AM

Nope, definitely no partitioning yesterday. In fact the only alteration i made all day was to change hda1 from NTFS to FAT32.

Both hdb1 and hdb2 mount correctly though (they're both reiserfs at /home and /usr/local/games respectively) so i don't think any data have been altered.

Is it possible to amend the types without losing the data?

syg00 03-09-2006 05:39 AM

Changing type is a doddle so long as the partitions align correctly - just use {c}fdisk.
While you're at it, take the hidden flag off hdb3 - change it from x'1f' to x'f'.
You just might get lucky and find all your logical partitions magically reappear.

Me, I'd be exercising a backup strategy. Soon, and often.

God knows what hdb4 is - I'd pretend it doesn't exist for now. But leave it there until your second backup completes ...

PsypherPunk 03-09-2006 05:52 AM

Cheers. All the logical partitions are just different distros to play with so no worries there. /home gets backed up often (or my girlfriend would kill me), the games are no biggie.

Off to cfdisk, i go...

PsypherPunk 03-10-2006 03:35 AM

Okay, it did it again.

i couldn't change the ID via cfdisk ("cannot change a partition into and extended partition"); i just deleted the awry extended partition and added back in the other drives on hdb - this time they've stayed put and all's well.

This time it's happened to hda and my main OS is now offline. Exactly the same thing - the extended partition now ID's itself as 1F and subsequently hides the logical partitions therein.

Thankfully i've still got everything backed up. Unless anyone knows a cunning way of altering that ID or fixing this i guess i'll just have to delete the partition.

syg00 03-10-2006 03:39 PM

Just delete if and redefine it starting at the same sector (cylinder these days) and the same size. This is one of the times I prefer fdisk over cfdisk.
Deletion of the part entry doesn't affect the data, although extended partitions can get a lot messier as the definitions for any logicals are imbedded in the space itself rather than the partition table.
Just make sure the type is extended.

syg00 03-10-2006 03:43 PM

Presuming you don't run as root on Linux, I'd be looking to (virus) scan that Windows system.
Pronto.


All times are GMT -5. The time now is 11:29 AM.