home btrfs partition lost its partition table!

I tried a few btrfs commands (btrfs subvolume create, btrfs subvolume delete) and everything worked well.
I rebooted my computer (opensuse 12.2 kernel 3.4.6-2.10) and it won’t boot. Goes into emergency mode. my btrfs home partition is not mounted and fdisk tells that /dev/sdc (the drive where /home resides) has not partition table! So since dev/sdc has not partittion table, all the btrfs tools do not work (as they say they don’t find a btrfs partition).
I tried the parted utility with no luck.
How can I recover my lost partition table please?

Do you know how it was partitioned? There may be a few possibilities here:

  1. you have written down how you partitioned on a piece of paper (inclusing start and end of every partition and the partition type);
  2. you have made an actual fdisk -l listing to so some file and have that file on a backup or otherwise outside that /home partition;
  3. you have created for that /home only one partition on the disk, taking the maximal amount of space.
    Whe you know exectly how it was partitioned using one or more of these (or other methods), you can use fdisk to create a fresh partition table with exactly the same entries. When that is all done without a glitch, the data inside the partitions thus recreated should be untouched.

There is fourth possibility - the whole disk was indeed used without partitioning.

Correct, but then we have to assume that the OP does not know this, else he would not have said “lost its partition table”.
But I agree that he does not give much evidence at all. E.g. where is that entry from the fstab?

Please @fd4242, support all you tell with computer evidence if possible. Thus if you talk about mounting at boot, show your fstab. If you say that fdisk tells somthing, show it. It is even more easy IMO to copy/paste your computer output in a post here (between CODE tags of ourse)) then to go and tell stories.

I agree I should paste as much info as possible from the troubled computer, but you will easily understand I couldn’t, since that computer won’t even boot!
Thanks for your suggestions – I am in case 3 above (my /home uses all of the space of disk /dev/sdc). Can you guide me to use fdisk to create a “fresh partition table with exactly the same entries” , or point me to some procedure please?
No, I do not have the output of fdisk -l stashed away somewhere, neither do have the start and end of my /home partition. But I am postiive it’s a btrfs partition that covers the whole /dev/sdc disk.

You say that your system goes into “emergency mode”. That means imho that yopu can log in (as root and with no password) and then do an fdisk -l. Isn’t that the case?

Else use your installation DVD, and boot in the Rescue entry there. This will also give you a text login, etc.

Or use a live CD if you have one.

As @arvidjaa allready pointed out, there are two possibilities now:
a) you had one partition taking all the space available;
b) you had no partitions at all, but put the file system directloy on the disk.
Case b) would also explain why there is no partition table. and it would also mean that you did not loose a apartition table (as you stated in your title and post), but that there never was one. What does your memory tell you about a) or b)?
In any case looking in the fstab will tell us if it is /dev/sdc or /de/sdc1.

On 2012-09-24 15:26, fd4242 wrote:

> But I am
> postiive it’s a btrfs partition that covers the whole /dev/sdc disk.

Then the disk would have no partition table at all. There would be a partition table inside the
btrfs partition, which you have to repair first (if possible somehow), or reformat and recover
from backup (and as you know that btrfs is experimental, you do have a backup, don’t you?)

If sdc had partitions, then gpart might be able to guess them.

You can boot from a rescue cd and post the data requested from there. Or attempt btrfs recovery
from there, too.


Cheers / Saludos,

Carlos E. R.
(from 12.1 x86_64 “Asparagus” at Telcontar)