0

I have a problem with my Linux system, I cannot access anything . So I am trying to boot from a live distro and save my home folder into an external hard drive .

I used to have the /home in a logical partition.

Now after booting from a live distro , I can't see my home partition in the side panel . Here is a screenshot of

parted -l  

enter image description here

testdik

enter image description here

Edit : boot-repair output : http://paste.ubuntu.com/6437066

6
  • You say /home used to be in a logical partition. Do you know if your system happens to have a second HD (which doesn't show up now) or are you sure the logical partition was on /dev/sda? What happens if you detach the USB-disk and reboot? (is /home still "lost"?)
    – Rik
    Nov 18, 2013 at 13:23
  • a second physical hard drive ? No . When installing my last system, since one or more than a year, I just configured the instalation to put /home in a different partition than the / , but not in another HD .
    – 4m1nh4j1
    Nov 18, 2013 at 13:26
  • I am trying to boot from HD now . Since 30 minutes, I am seeing a message like this repeating with different parameters : hub 1-0:1.0: over-current change on port
    – 4m1nh4j1
    Nov 18, 2013 at 13:29
  • When in that original Linux version... is the /home still completely empty? According to cat /etc/passwd should there be any subdirectories (that are not there anymore, like /home/username)?
    – Rik
    Nov 18, 2013 at 13:40
  • The old system /home is empty, and I can't find my user name in passwd, I think I lost the old passwd because I tried boot-repair and maybe other disk utility .
    – 4m1nh4j1
    Nov 18, 2013 at 13:51

3 Answers 3

1

If the /home is also completely empty when viewing in the original Linux OS you might want to look at this article (The "Recover lost partition"-part). It could be you have overwritten you partition table of /dev/sda (loosing sda2 etc...). You can run mentioned TestDisk utility to analyse if the partition is salvageable. In your case you should use sda instead of the sdb they used.

Instruction to recover from an overwritten partition table can be found here. I copied the relevant bits below:


How to recover partitions and data using Linux - Tutorial

Recover lost partition

There could be many reasons why your partitions no longer show up. For example, you may accidentally create a new partition table on the wrong hard disk. This might happen when setting up a multi-boot setup.

To be able to show you a real-life would-be disaster scenario, I will simulate the loss of partition. Our test box will be Fedora 16 Verne, with KDE. We will try our little disaster game a secondary disk, /dev/sdb, which is used for data, although this kind of problem could also happen on system partitions. In that case, you will have to use a live CD to try to recover your box.

We will destroy the partition table for /dev/sdb, by creating a new one in GParted. We will ignore the fact there already is one on the disk. This way, we will vanish the partitions, making them invisible to the system. To a casual user, it will look as if the data is forever lost. All right, here's how it's supposed to be, on a healthy system:

enter image description here

So we destroy the partition table. Now, we will use TestDisk, an awesome forensics tool developed by cgsecurity.org. I have listed this program many times before in a variety of articles, but we've never really used it in anger. Today, we will explore its capabilities, as well as learn how to use it.

TestDisk runs as a text wizard inside the shell. It's an interactive tool that will ask you a few questions to try to salvage your data. The first question is to decide whether you wish to keep the log for future examination. If you're doing forensics, then you probably want to do this.

enter image description here

We will begin with the analysis. We do not know what the situation is, or how bad it is. Since you probably do not know the exact disk geometry by heart, using the analysis, notice the proper English spelling, is your best bet in figuring out the existence and location of previous partitions.

enter image description here

The next step is to choose which device we want to work with. In our case, /dev/sdb.

enter image description here

Now, choose the partition table type. For most people, it will be Intel/PC.

enter image description here

And we begin the analysis:

enter image description here

We are lucky. TestDisk was able to find the partition. Even though the old partition table was destroyed, it was just a pointer to the start and end addresses of the actual data, so to speak. The disk surface was not harmed, and therefore, our data should be there.

enter image description here

Now, we need to write the partition information to disk. It is also possible to change the partition characteristics, like type and flags.

enter image description here

And it's worked! Boom, we're back in business. Now, this means we have a sane partition table and our partitions can be used, but this does not mean some of the data has not been permanently overwritten or destroyed forever. We will further explore this second part of the partition and data recovery below. For now, things are looking good.

enter image description here

0

It doesn't look like you have a home partition.
Partition 1 - is 316GB in size, on a 320GB drive.
I'd say home is in there.

4
  • the home folder is empty :/
    – 4m1nh4j1
    Nov 18, 2013 at 11:59
  • @4m1nh4j1 You will be seeing the home folder of your live system. Run mount to see where /dev/sda1 has been mounted and take a look in there.
    – n.st
    Nov 18, 2013 at 12:29
  • In your case, that seems to be /mnt/boot-sav/sda1, of which only 203 MB are occupied. This doesn't exactly look good.
    – n.st
    Nov 18, 2013 at 12:33
  • I am seeing that the mounted sda contains an empty home folder .
    – 4m1nh4j1
    Nov 18, 2013 at 12:36
0

You may want to try fixparts, an excellent instrument available in many distros (Debian-like, Fedora, RedHat,...), or you may download it from SourceForge, as detailed in this Web page.

The reason for using fixparts is simple: in the above quoted Web page, its author states:

It can repair mis-sized extended partitions. These partitions normally serve as placeholders for logical partitions, but some partitioning tools miscompute the size of the extended partition, which can cause problems. FixParts is designed in such a way that this type of repair occurs automatically, so if it's the only problem with your disk, you can launch the program and then immediately save the partition table (as described in the upcoming section Saving Your Changes), making no manual changes, and the program will fix the problem.

......

The first check that the program performs is for stray GPT data. Such data can remain behind on a disk if it was previously used on a Macintosh or in some other ways, then re-used as a conventional MBR disk. Although such leftover data should not technically be a problem because the GPT specification clearly states that such disks are not GPT disks and should therefore be treated as MBR disks, some utilities can be confused by the presence of both MBR and GPT data. Thus, FixParts checks for this condition when it starts.

...be aware that TestDisk sometimes creates improperly-sized extended partitions, so you may need to use FixParts after you use TestDisk.

All of these conditions are potentially relevant to your problem.

It is wise to save the existing partition table in a safe place (careful if you are using a live distro, its added content may be volatile!), by means of

 sfdisk -d /dev/sdc > parts.txt

(it may later be restored by means of

 sfdisk -f /dev/sdc < parts.txt

), after which you may launch fixparts as follows:

 fixparts /dev/sda 

after which, again in the author's words,

FixParts checks the validity of the partitions it finds on your disk and will automatically (and silently) make adjustments for certain problems it finds. Thus, you may discover that your partition table is fine at this point. It's also possible that you'll see some changes in primary vs. logical status, or even omitted partitions.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .