# Backup Harddrive Unmounting Self?

## javagamer

Hi,

   I just switched from Ubuntu to Gentoo becuase my computer was feeling bloated.  I've been able to sucessfully install Gentoo, but it seems for some reason I'm unable to transfer a significant quantity of files from my backup harddrive (it's an internal harddrive I use for backups) before it magically unmounts itself and moves from /dev/sdb1 to /dev/sdc1.  I've tried copying from KDE and using cp -R in the command line, but neither works.

Here's my fstab:

```
/dev/sda1               /boot           ext3            noauto,noatime  1 2

/dev/sda3               /               ext3            noatime         0 1

/dev/sda2               none            swap            sw              0 0

/dev/cdrom              /mnt/cdrom      auto            noauto,user     0 0

/dev/sdb1               /mnt/backup     ext3            ro,noauto,user  0 1
```

And I've included two dmesg from where it first says sdb1 to when it says sdc:

Log 1 - http://pastebin.com/m1a4748e9

Log 2 - http://pastebin.com/m357fdbd1

Any help would be apreciated.

Edit: removed a rogue tag

----------

## javagamer

Just confirming that it continues on, as in, when I mount /dev/sdc1 it copies for a while then switches over to /dev/sdd1.  Here's a copy of dmesg | grep sdc in hopes that it will help someone figure out what's wrong: http://pastebin.com/m1a55d0a8

Update: I tried running fsck on /dev/sde1 (which is what it now moved to) and everything seems fine, I ran fsck -v /dev/sdeee1 and it returned

```
/dev/sde1: clean, 3643296/39075840 files, 86926294/156282320 blocks
```

I guess this is good news since this is my backup harddrive and I really need the data, but it means I'm still not sure what's wrong.

----------

## javagamer

Turns out I spoke to early, when I forced fsck to recheck the drive there appears to certainly be something wrong with it.  I was running fsck -f -v -c -y and after almost 24 hours it was at something involving inodes.  Unfortuneatly, to make things worse I managed to knock the powercord out while it was still running.  While it doesn't appear any worse than before it doesn't seem any better.  Before I make matters even worse I'm hoping someone here can suggest what I should do.  As is, I can still move maybe a minute or so of files off of the harddrive before it crashes.  Help is definitely appreciated.

----------

## Akkara

Is this connected via e-sata?  It looks like it can't maintain a good 3.0 GB/s connection.  Try setting the jumper on the drive to force it to the 1.5 Gb/s speed.

Also, some external hard-drives spin down on their own and the kernel gets confused because it didn't tell it to and it doesn't know to spin back up.  I had to add a udev rule for a Seagate freeagent USB drive.  Perhaps your drive needs something similar as well.

cat /etc/udev/rules.d/99-freeagent.rules

```
ACTION=="add", SUBSYSTEM=="scsi_device", ATTRS{vendor}=="Seagate*", ATTRS{model}=="FreeAgent*", \

    RUN+="/bin/sh -c 'echo 1 > /sys/class/scsi_disk/%k/allow_restart'"
```

----------

## javagamer

No, it's an internal harddrive I just use for backups.  It's always worked fine in Ubuntu, it's just now that I've switched that I've been getting problems.

----------

## Earthwings

The logs don't look too good. At a minimum have e2fsck run fully over it and have it fix the errors. It is also a good idea to run some smartd tests, e.g.

```
smartctl --test=short /dev/sdb

# wait for it to finish

smartctl -a /dev/sdb
```

What is the drive's behavior on errors? Ubuntu usually mounts them read-only then (errors=remount-ro option in /etc/fstab). You can find that out using 

```
dumpe2fs -h /dev/sdb1 | grep "^Errors behavior:"
```

The reason for the behavior may be that due to errors encountered when writing files the drive is shut down.

----------

## javagamer

So, first I run e2fsck -p, then the smartd tests?  Is there a chance e2fsck makes it any worse, because as is I can at least see all of the files, I just can't move a significant ammount at a time.

Also, the errors behavior is "Continue".

----------

## Earthwings

You can run the smart tests before, they're independent of the file system.

e2fsck making it worse -- well, never heard of that, but I wouldn't say it's impossible. Personally I'd run it (assuming you have a copy of all data elsewhere).

----------

## javagamer

I don't really have the data elsewhere, I replaced my Ubuntu installation which had all my data, with Gentoo because I assumed I had a backup.  In theory I could probably recover some of it from the harddrive I have Gentoo installed on, but I don't have any other copies.  In the future I'll have a second drive for monthly backups and I'll have both of them tested to make sure they don't get corrupted.  So, since this is basically my copy of this data what should I do?

----------

## javagamer

Here's the results of the SMART test: http://pastebin.com/m17693a61

If I read it correctly it seems to think my harddrive is fine.

----------

## Earthwings

Ok, the smart results look good, so it's probably only some corruptions in the file system, but the drive itself is healthy. In your case I'd get a spare drive and copy everything from the current backup drive to it using dd_rescue. Then you can run e2fsck on one of the drives and see what happens. If it leads to corruption, you still have the same data on the other drive.

----------

## javagamer

Awww... that means getting another drive, but I could use another.  That way I can have monthly backups as well  :Wink:   Thanks for your help, probably be a while before I can say if I've got my data back.

----------

## javagamer

Running ddrescue -v -r 1 /dev/sdb /dev/sdc and I just realized I forgot to include a logfile, is that bad?

Anyways, at the moment it says it rescued 27377 kB with an errsize 640 GB  :Sad: 

At the moment the only numbers I see changing are ipos and opos which are both the same and at 19071 MB as of typing this, is this alright for running just for 15-30 minutes?  Also, is there anything else I should do, or should I just sit back and let it copy?

Oh, and how long should I be waiting around for this, I don't mind a few days (though a few hours is preferable), but I'm pretty sure I can't wait weeks.

----------

## javagamer

*bump* ipos and opos are both at 380961 MB and average rate has dropped to 66 B/s, but other than that nothing has changed, though it does appear to be moving significantly slower.  Is there anything I can do to speed it up, is it even accomplishing anything now?  Also, is there some default log it writes to, or will I be unable to pause or resume it should something happen?

*sigh* I just want my data... :/

----------

## Roman_Gruber

hello

one way of doing backups or copying data is using rdiff-backup. => there you can be sure, its 100 % copied, but wiht the directory structure, I always put the hole thing in a sub directory.

also boot from a livecd and copy the data, its the best when less daemons are running on the box...

----------

## javagamer

The problem here is that lots of the backup harddrive seems corrupted so I'm not sure rdiff-backup would work for copying it over to the new harddrive.  However, my backup script did use rdiff-backup to make it's backups.

Also, if I run it off a livecd would it still take as long?  It would be hard to get buy without my computer for the week or two it looks like ddrescue will take at it's current rate.

And finally, I just accidentally pulled the eSATA cable out of the harddrive I'm copying stuff over to, but I put it back as soon as I noticed and it seems to still be moving along.

----------

## Roman_Gruber

try to recover the data twice, just in case   :Rolling Eyes: 

----------

## javagamer

What do you mean? Stop the ddrescue and start a new one?

----------

## Earthwings

 *javagamer wrote:*   

> What do you mean? Stop the ddrescue and start a new one?

 

I'd do that, yes.

When the copy operation becomes slow, watch dmesg. Likely there are hardware problems showing up. 

```
watch -n 30 'dmesg | tail'
```

 is useful to monitor it from a second shell.

----------

## javagamer

Wow!  In under 6 hours it completed after I restarted it as opposed to the last 6 days of waiting for it to finish.  Strangely the problem seems like it may have resolved itself, now I can copy off the backup (of the backup) I just made without any problems.  I'll get all my files off and then try running e2fsck on my original backup drive to see if anything was wrong with it.

Thanks a lot for all the help!  :Very Happy: 

----------

