LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   Information lost in one partition after new ubuntu installation (https://www.linuxquestions.org/questions/linux-software-2/information-lost-in-one-partition-after-new-ubuntu-installation-4175449672/)

cruzdelsur 02-11-2013 10:01 AM

Information lost in one partition after new ubuntu installation
 
Hi guys!!

Here is my issue.
After a long time, I decided to change to Ubuntu 12.04 (I was using 10.04). I had 3 partitions in my laptop: 1 of 90GB (with the "system files"), 1 of 100 GB with the /home directory and another one of 130GB, used as an external device, called /media/datos.
I formatted the / and /home directories to install the new Ubuntu version and kept without formatting the /media/datos directory. It was almost full, because I moved all the information there so I could format the other partitions. I have done this before, when I reinstalled Ubuntu 10.04, several times, and I've never have had any problems.
But now, I have lost information :( I have lost around 28GB of information!!!
I don't know why this happened, and I wonder if is there a way I can recover them?? Is there???
Thank you all!

pingu 02-11-2013 01:59 PM

First of all, try to keep calm.
I actually suggest you put away the keyboard for a while, just read & think.

So, was that partition for /media/datos really reformatted, or is it just that you can't see it?
If you are going to do things on this laptop, first thing you do is make sure that the partition for /media/datos is unmounted!
You could mount it with the ro flag - that is readonly, non-writable.
This is very, very important - if you keep writing to a formatted or in some other way damaged partition you will make recovery more and more difficult!
And the system writes stuff, it's not only what you yourself does!

Now that this is (hopefully) clear, let's see what happened?

Is the partition still there? (sudo fdisk -l)
What filesystem was on it, is that fs supported in your new system?
What do you mean with "used as an external device" - is it a USB-disk?
If so, is it recognized at all? Try with some other usb-stick/drive, can you see it correctly?
----
Edit
You say this partition was 130GB in size, but you lost "only" 28 GB?
Is the rest there? What exactly has happened - only a lost link or what??

cruzdelsur 02-11-2013 04:06 PM

Hi,

Thanks Pingu for you reply!! I'll try to answer all your questions.

The partition /media/datos was not reformatted. It existed before I installed this version of Ubuntu, and I have kept it for a long time. I can see it right now. It has 130Gb of space, 76% of them seem to be used now. Before I installed this Ubuntu version, I moved a lot of files there, so I guess in that moment around 99% of the space was used. That's why I said I lost around 28GB of data, because it was almost full, and now I have 24% of free space. And yes, the other data is there, only 28 GB disappeared.

Ok, I unmonted it. I unmounted it with umount, is this correct?

Here is the readout of fdisk -l:

consuelo@consuelo-Aspire-5734Z:~$ sudo fdisk -l

Disco /dev/sda: 320.1 GB, 320072933376 bytes
255 cabezas, 63 sectores/pista, 38913 cilindros, 625142448 sectores en total
Unidades = sectores de 1 * 512 = 512 bytes
Tamaño de sector (lógico / físico): 512 bytes / 512 bytes
Tamaño E/S (mínimo/óptimo): 512 bytes / 512 bytes
Identificador del disco: 0x000a1c5c

Dispositivo Inicio Comienzo Fin Bloques Id Sistema
/dev/sda1 2048 585727 291840 82 Linux swap / Solaris
/dev/sda2 * 585728 176367615 87890944 83 Linux
/dev/sda3 176367616 371679231 97655808 83 Linux
/dev/sda4 371681278 625141759 126730241 5 Extendida
/dev/sda5 371681280 625141759 126730240 83 Linux

What I meant with "used as an external device" was that the partition is placed in /media, where the external devides are mounted. It's not an external device, sorry for my not-proper definition, that's why I used the "". But as I mentioned before, I have done this before, and I never had any problems. :(

So I don't know... any ideas? Did I make myself clear now? I'm not an expert, just a girl using linux :)

michaelk 02-11-2013 05:21 PM

Also post the output of the command:
df -h

cruzdelsur 02-11-2013 07:04 PM

Hi!! here it is!

Code:

S.ficheros    Tamaño Usados  Disp Uso% Montado en
/dev/sda2        83G  4,9G  74G  7% /
udev            1,5G  4,0K  1,5G  1% /dev
tmpfs            592M  876K  591M  1% /run
none            5,0M      0  5,0M  0% /run/lock
none            1,5G  392K  1,5G  1% /run/shm
/dev/sda3        92G  2,7G  85G  4% /home


michaelk 02-11-2013 07:24 PM

Your data partition i.e. sda5 is not mounted.

As suggested mount it read only. It isn't obvious what has happened but the partition is still intact.

cruzdelsur 02-11-2013 08:13 PM

Okey, I mounted it read only:

Code:

S.ficheros    Tamaño Usados  Disp Uso% Montado en
/dev/sda2        83G  4,9G  74G  7% /
udev            1,5G  4,0K  1,5G  1% /dev
tmpfs            592M  876K  591M  1% /run
none            5,0M      0  5,0M  0% /run/lock
none            1,5G  392K  1,5G  1% /run/shm
/dev/sda3        92G  2,7G  85G  4% /home
/dev/sda5        119G    87G  27G  77% /media/datos


cruzdelsur 02-11-2013 09:09 PM

Well, this is what I did when I installed Ubuntu:

https://www.dropbox.com/s/aq63sgpwcp...creenshot1.png
However, I didn't take that screenshot when I installed Ubuntu, I did it just now, so you could understand what I did. I don't remember how much of the disk was used (or said to be used) when I installed it. :/

TobiSGD 02-11-2013 09:35 PM

That screenshot looks right, exactly like it should have been (although you should be aware that a backup on the same disk you are working on can not count as backup).
I would recommend to keep the data partition mounted read-only for now (or unmounted) and use Photorec to scan the free space on that partition for your files.

cruzdelsur 02-11-2013 09:56 PM

Yeah, I guess it doesn't count as backup. :/ I trusted on it because it has worked before. :( I'll try photorec. Thanks

cruzdelsur 02-11-2013 10:07 PM

TobiSGD, I have a dummie question. Which of these partitions should I select for Photorec?

/dev/sda4 371681278 625141759 126730241 5 Extended
/dev/sda5 371681280 625141759 126730240 83 Linux

michaelk 02-11-2013 10:17 PM

/dev/sda5

cruzdelsur 02-12-2013 10:58 AM

Hi!! Help!!! It seems I made a mistake! Here is what I did, step by step.

1) I run Photorec in /dev/sda4!! Yeah, my mistake! I didn't wait for a reply, I searched in Internet and found (or thought I found) people that recovered that partition... so I did. I wanted to do it while I was asleep... I also selected the wrong type of files to recover (not the ext2,ext3,ext4). So... a couple of mistake...

2) I ended up with 37 protected folders with lots of files, some of them split. Most of them were in the partition already. So, kind of useless.

3) So... I deleted them! :) they were saved in my /home folder, but as mentioned, they were protected. So I sudo nautilus and deleted them. Then, emptied the trash bin.

4) The thing, is that I'm running Photorec again (in the /dev/sda5 and recovering the right files now), but there's seems to be no free space in my /home directory. Somehow, I think those protected folders were not deleted and are messing around somewhere... ??? could it be possible??

5) What can I do to delete them?

Thank youuuu!!!! Sorry for my not perfect English!

cruzdelsur 02-12-2013 11:04 AM

BTW, the good news are that the files are still there...

pingu 02-12-2013 11:54 AM

A few things:
1) It might be that some processes keeps the files open.
Check with
# sudo lsof -n |grep file
to see all files currently in use,
# lsof | grep deleted
to see deleted files.

2) Default is still to reserve 5% of each ext# partition for root.
Change that to 1%:
tune2fs -m1 /dev/sda5

3) I also found this on one site:
"Even after emptying your trash your files will remain in ~/.local/share/Trash/expunged until after a reboot and maybe even longer. "

4) Are there hidden files?
Hidden files have a '.' as first letter, it might be that Nautilus is set not to show hidden files.
Change Nautilus settings, or in terminal "#ls -a /home/wherever"

5) you could try fsck, use it with -N then it won't do anything, just show what would have been done.

cruzdelsur 02-12-2013 12:00 PM

Thanks!!
I'll give it a try!

pingu 02-12-2013 12:01 PM

I'm trying to do some thinking here.
* Are you sure you have lost files?
There is a difference in how apps display disk size.
Your 130GB partition is displayed as 119GB by df (post #7). (Some apps lazily uses '1000' for MB & GB instead of 1024, so 1000kB is actually not quite 1MB etc.)

* Are you sure your /dev/sda5 was mounted on media/datos when you copied?
If not, you would have filled the / partition /dev/sda2 instead of /dev/sda5, and / could show 99% usage.
I so hope this is not the case, because if so you have most probably lost your files. (Or have to pay big money to get them back.)

cruzdelsur 02-12-2013 04:29 PM

Well, I'm pretty sure I lost mysteriously those files... I understand what you say about the partition size, but when I run Photorec, it found files that were not visible on the partition, and that I was aware I have saved there. So they were insivible :O

I'm also sure I mounted my /dev/sda5 on /media/datos because I didn't want to lose my info, so I made sure I mounted them there.

The 99% of usage was not due to that I mounted there, because before I run Photorec I have lots of free space, since I have formatted recently that partition.

I'll let you know what happened when Photorec finishes.

Thank you all!!!

cruzdelsur 02-12-2013 06:05 PM

Well, well... I think I recover most of the files :) happy me!!
I'll have to rename them though... it will take me some time :/ But at least, I got them back. :)

Should it be safe to mount normally my /media/datos partition?

cruzdelsur 02-13-2013 09:29 AM

Hi again,

Another question... I don't know how to mount again the partition to be usable again... (It's read-only now...)
Thanks!

cruzdelsur 02-17-2013 09:28 AM

(I'll be offline until next Sunday, just in case!)

chrism01 02-17-2013 06:53 PM

Assuming you are sure
Code:

# if partition & mt pt is defined in fstab,
# use this with mt pt or partition
mount -o remount,rw /media/datos

# specify both if its not defined in fstab
mount -o remount,rw /dev/sda5  /media/datos


cruzdelsur 03-05-2013 09:23 AM

Hi guys,

I tried the first option Chris suggested, but I didn't work as I wanted. I'm able to see the partition now, if I go to media. But The files are still protected. Should I just change that with chmod? or is there something else I should do?

This is my fstab file:

# /etc/fstab: static file system information.
#
# Use 'blkid' to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name devices
# that works even if disks are added and removed. See fstab(5).
#
# <file system> <mount point> <type> <options> <dump> <pass>
proc /proc proc nodev,noexec,nosuid 0 0
# / was on /dev/sda2 during installation
UUID=b08baef3-c005-4070-aa15-227d73102c66 / ext4 errors=remount-ro 0 1
# /home was on /dev/sda3 during installation
UUID=dbd1d13b-a045-4029-8192-59f96a968680 /home ext4 defaults 0 2
# /media/datos was on /dev/sda5 during installation
UUID=9c407492-2dcf-4641-b411-328633ccdd2d /media/datos ext4 defaults 0 2
# swap was on /dev/sda1 during installation
UUID=1440874c-35b7-4dbd-9318-1fa3fc408f45 none swap sw 0 0


Thank you so much!!!

cruzdelsur 03-06-2013 04:32 PM

Please, anyone?

cruzdelsur 03-09-2013 06:09 PM

Well, I guess it's time to close this post. Thanks everyone.


All times are GMT -5. The time now is 09:05 PM.