Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Filesystem corrupted during backup
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware
View previous topic :: View next topic  
Author Message
Rinne
n00b
n00b


Joined: 14 Sep 2008
Posts: 14

PostPosted: Sun Oct 18, 2015 3:44 pm    Post subject: Filesystem corrupted during backup Reply with quote

Hi all,

I have a rather tricky situation and didn't find a solution yet.

I tried to backup my home folder to an external hdd. Unfortunately I was dumb enough to do so via
Code:
cp -R /home/* ....
in a terminal.
The folder contained some invalid filenames with special characters that were placed by applications and gave out messages they would be ignored.

During the copy process my machine locked up and after not responding for quite some time, I did a hard power-off.

When I booted back up, my home folder was corrupted. As in, a lot of (random) files and folders were missing. As far as I can see all Symlinks are broken as well.
Despite being on the same partition as the root system, only my home folder is affected, and only to a degree that I can still use most things.
Apparently only two files have been copied to the external hdd.

Most important files are intact, but my thunderbird profile including all mail is gone which I'd really like to restore.

Does anyone have an idea what could have happened?
Any possible solutions?

Both source and target filesystems were ext4.

The source hdd is a ssd. I know it can make recovery hard/impossible.

Immediately after I noticed the errors (so immediately after boot) I shut down and booted to a rescue system. Then cloned the whole partition to the external hdd. Not sure if that's of any help.

Best regards and thanks in advance
Rinne
Back to top
View user's profile Send private message
jonathan183
Guru
Guru


Joined: 13 Dec 2011
Posts: 308

PostPosted: Sun Oct 18, 2015 4:15 pm    Post subject: Reply with quote

using cp should not have been a problem unless you managed to specify some part of the /home folder as the destination. What was the exact command you typed at the terminal?
Your best hope is to mount the drive read only, boot from a live CD until you have finished trying to save data.
I dont have an ssd drive but have found testdisk has done a good job in the past.

My strategy would be to boot from a live cd like systemrescueCD, mount the ssd partition read only, copy readable information somewhere else (like an external hard drive), unmount the ssd, run testdisk on it and try to find the missing information. Copy all useful information to an external hard drive, then work out what caused trashing of the filesystem ...
Back to top
View user's profile Send private message
eccerr0r
Watchman
Watchman


Joined: 01 Jul 2004
Posts: 7069
Location: almost Mile High in the USA

PostPosted: Sun Oct 18, 2015 4:16 pm    Post subject: Reply with quote

You probably had some hidden corruption in your SSD that the copy uncovered. What kernel are you using (I remember a version of the kernel had a bad ext4 driver that could have caused corruption.

Curious what brand of SSD is it?
_________________
Intel Core i7 2700K@ 4.1GHz/HD3000 graphics/8GB DDR3/180GB SSD
What am I supposed watching?
Back to top
View user's profile Send private message
Irre
Guru
Guru


Joined: 09 Nov 2013
Posts: 336
Location: Stockholm

PostPosted: Sun Oct 18, 2015 5:29 pm    Post subject: Reply with quote

I think the combination ext4 and ssd is really really bad :evil: The filesystem was not possible to recover. It has happened to my three Raspberry PI (early models with sd-cards).

And much worse it happened to my: mobile phone! Google Nexus 5 with Android 5.1.1 which uses the ext4 file system :twisted: I think I lost hundreds of dollars there. I was able to reflash the system but the corrupted ext4 file system remains. :cry:
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 42800
Location: 56N 3W

PostPosted: Sun Oct 18, 2015 5:40 pm    Post subject: Reply with quote

Irre,

That's a feature of the early Pis. The SD Cards can embarrass the PSU if you use a phone charger as the PSU.
If you provide power through the expansion header, its not an issue.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
Irre
Guru
Guru


Joined: 09 Nov 2013
Posts: 336
Location: Stockholm

PostPosted: Sun Oct 18, 2015 6:02 pm    Post subject: Reply with quote

NeddySeagoon wrote:
If you provide power through the expansion header, its not an issue.
That problem is gone as I only use the SD-cards read only now. The linux file systems are all moved to external usb-disks. :)
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 42800
Location: 56N 3W

PostPosted: Sun Oct 18, 2015 6:04 pm    Post subject: Reply with quote

Irre,

I do that too ... and root over NFS :)
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
eccerr0r
Watchman
Watchman


Joined: 01 Jul 2004
Posts: 7069
Location: almost Mile High in the USA

PostPosted: Mon Oct 19, 2015 12:11 am    Post subject: Reply with quote

I use ext4 on my real SSDs with trim enabled, and they work fine. I probably got lucky and didn't install the broken version of the kernel, but ext4 seems to work fine for me (setup three ext4 Linux root partitions on a Crucial and two Intel SSDs).

I do have to say that SD (micro SD, SDHC, all of them) cards which I will not call "SSD" because they tend to be really horrible in terms of reliability. I've lost several of these cards over the years after they wear out prematurely (or at least I feel that to be the case.) CF cards seem much more reliable for me over the years.

I don't have much of an opinion yet about eMMCs that were meant to be used as root filesystems for OS. I kind of doubt they know how to trim, and I doubt they have write buffering so they are doing write through... Of the eMMCs that I do have and used extensively, so far so good...
_________________
Intel Core i7 2700K@ 4.1GHz/HD3000 graphics/8GB DDR3/180GB SSD
What am I supposed watching?
Back to top
View user's profile Send private message
Buffoon
Veteran
Veteran


Joined: 17 Jun 2015
Posts: 1074
Location: EU or US

PostPosted: Mon Oct 19, 2015 12:19 am    Post subject: Reply with quote

Maybe flash media is better now, but ext4 journaling could kill earlier chips.
Back to top
View user's profile Send private message
Irre
Guru
Guru


Joined: 09 Nov 2013
Posts: 336
Location: Stockholm

PostPosted: Mon Oct 19, 2015 6:56 am    Post subject: Reply with quote

Buffoon wrote:
Maybe flash media is better now, but ext4 journaling could kill earlier chips.

Maybe the f2fs file system "Samsung's Flash Friendly File System" is something to consider :?:
http://forum.xda-developers.com/showthread.php?t=2697069
Back to top
View user's profile Send private message
krinn
Watchman
Watchman


Joined: 02 May 2003
Posts: 7001

PostPosted: Mon Oct 19, 2015 10:21 am    Post subject: Re: Filesystem corrupted during backup Reply with quote

Rinne wrote:
I tried to backup my home folder to an external hdd. Unfortunately I was dumb enough to do so via
Code:
cp -R /home/* ....
in a terminal.


Generally you don't need to seek errors beyond the ones of the user.
cp source target, read only source. If source gets corrupt it's because user did something bad, like using his source also as target.
I don't think any SSD controller would start trimming when the device is busy reading (that would cut its perf down).

You won't be the first to do a mistake, and people keep rm that or this directory because of a simple mistake.
You should look at your bash history.
Back to top
View user's profile Send private message
eccerr0r
Watchman
Watchman


Joined: 01 Jul 2004
Posts: 7069
Location: almost Mile High in the USA

PostPosted: Mon Oct 19, 2015 5:42 pm    Post subject: Reply with quote

I'm not sure if using cp could ever result in corrupted filenames, this is more due to either media or OS/filesystem failure.

SSDs also have SMART that you can access with smartmontools, make sure you don't have media wear. Most modern SATA SSds have meaningful data indicating how worn the SSD is, and should expect errors if it's worn out. Again if this is a SD* media, all bets are off. I'm not even convinced wear leveling in SD* media is very good...
_________________
Intel Core i7 2700K@ 4.1GHz/HD3000 graphics/8GB DDR3/180GB SSD
What am I supposed watching?
Back to top
View user's profile Send private message
Roman_Gruber
Advocate
Advocate


Joined: 03 Oct 2006
Posts: 3806
Location: Austro Bavaria

PostPosted: Tue Oct 20, 2015 1:54 pm    Post subject: Reply with quote

backups with

cp -axr

are working fine. and even boot here.

I only have this plextor ssd PLEXTOR PX-128M3, but it was hell expensive as i bought it, and still is far decent regarding online benchmark homepage.
Back to top
View user's profile Send private message
Rinne
n00b
n00b


Joined: 14 Sep 2008
Posts: 14

PostPosted: Sun Oct 25, 2015 1:33 pm    Post subject: Reply with quote

Hi all, thanks for the plenty replies and hints.

I have recovered all of my important files from other sources in the mean time and don't need to try and recover anything anymore.
I'll answer everything anyways.

I tried to use fsck but it didnt find any corruption. Also did some more checks on the cloned partition, but not sure if that can even bring out errors.

I just used cp from my ssd to an external drive. My bash history is:

Code:

475 groups rinne
476 su   # Worked as root here, this session was ended before the following though
477 cd ..
478 ls
479 cp -R rinne/ /run/media/rinne/35B1-C589/HOME/   # Failed because of invalid filenames, aborted with ctrl+x
480 cp -R "rinne/" "/run/media/rinne/35B1-C589/HOME/"   # Failed again. I don't know why I even tried
481 cp -help
482 cp --help
483 cp -R * /run/media/rinne/35B1-C589/HOME/ # This is where it went bad. (Current folder I cp -R * on is /home, btw.)


The drive I use is a 256GB Crucial M4.
My Kernel is 4.0.5

Smartmontools says Everything is fine, but I'm running the offline test etc. now.

I will also looking into migrating to F2FS.

Thanks a lot. :)
Back to top
View user's profile Send private message
eccerr0r
Watchman
Watchman


Joined: 01 Jul 2004
Posts: 7069
Location: almost Mile High in the USA

PostPosted: Sun Oct 25, 2015 5:17 pm    Post subject: Reply with quote

I'd look into making sure your RAM is good too in this case...

(I had a 128G Crucial M4, also run ext4fs on it... no problems... gave it away after upgrading.)
_________________
Intel Core i7 2700K@ 4.1GHz/HD3000 graphics/8GB DDR3/180GB SSD
What am I supposed watching?
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum