LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware
User Name
Password
Linux - Hardware This forum is for Hardware issues.
Having trouble installing a piece of hardware? Want to know if that peripheral is compatible with Linux?

Notices


Reply
  Search this Thread
Old 06-23-2011, 04:59 AM   #1
PaulFC5
Member
 
Registered: Feb 2008
Location: Auckland, Aotearoa/NZ
Posts: 98

Rep: Reputation: 13
USB hard drive not reading


I have been backing up onto a 60G ext2/3/4 partition on a 1TB external USB hard disk for a year or so now and have built up a few folders of .thunderbird, .mozilla, and other assorted files - using this as my standard "backup system" - but suddenly all the files and folders in this partition seem to have disappeared.

In Gparted and KParted the partition shows up as the correct size with the correct amount of "used space" (= yellow coloured portion), as it does when running offof any CD/standalone OS.
And the small bars under the volume names in Dolphin show about the right amount having been "used" too.
But however I try to access this partition (or, to be correct LVM I spose:-)) it still always comes up as empty - ie 0 files in it. After months of working just fine.
The NTFS partition on the same external USB sdd reads and writes quite OK/normally and also shows the correct amount of "used space" - but even from root I can't see any of the old files in, or read/write to the linux one. It comes up with "Denied"/"Can't Write to.." errors when trying to write anything to it.

I ran a freeware utility called DiskInternals Linux-Recovery from winDoze which, after half an hour, came up with a list showing all the folders and files in the partition. It said that they would be written back onto the hard drive that they were "retrieved" from - but no change happened - still no contents showing when booting up in any linux :-(

Any ideas please??
TIA
Paul W

Running a clean install of FedoraCore14 on an AMDAthlonx2 5000 (= 2.6G true) on an ASUS M2N-MX SE PLUS m/b with 2G of RAM

Last edited by PaulFC5; 06-23-2011 at 05:00 AM. Reason: missed word
 
Old 06-24-2011, 01:56 AM   #2
pcardout
Member
 
Registered: Jun 2003
Location: Socorro, New Mexico
Distribution: Debian ("jessie", "squeeze"), Linux Mint (Serena), XUbuntu
Posts: 221

Rep: Reputation: 24
Here are some ideas -- they all revolve around thinking that your hardware is fine and your data is there but your drive is no longer mounting properly.
Do you think your drive is mounting? I know it is detected because you report using Gparted.

Type df -h and mount and post both here.

Where I'm going to go next with this is to start talking about /etc/fstab and making sure the drive information is correct.
(Actually LVM COULD have messed up and so is not mounting your drive ... where I'm going to go after this is to tell you
how to figure out what your drive is really called (using dmesg or tail -f /var/log/syslog) and then
use that partition name in fstab.)

Last edited by pcardout; 06-24-2011 at 01:58 AM.
 
Old 06-24-2011, 09:56 PM   #3
PaulFC5
Member
 
Registered: Feb 2008
Location: Auckland, Aotearoa/NZ
Posts: 98

Original Poster
Rep: Reputation: 13
Thanks for that pcardout.
Love the Galileo quote

Yes - I too wonder about it not mounting properly.
And the hardware seems to be fine - as you say it's being detected OK - and, as I say, whatever CD>RAMlinux I boot with picks it up with the same /media description and what looks like the right proportion showing as "used".
At one stage I may have had the USBextsdd thingo turned on when the machine was rebooted and I'm wondering if my "plain" bunch of ext2,3,4 folders/files got themselves converted into an LVM or PV or something like that.

And yes :-), the next "project" is to chop the enormous 500G LVM it made for itself on the "clean" install a few days ago down to something a bit more sensible/useful - didn't realise that the new installation would use everything that was available when I did it.
And AAMOI this all came about from my "upgrading" over the last few months from 12>13>14 which produced an almost worthless "Frankinstein" install - nothing much working.

Here's what came up with the commands you suggested:

df -h gives:

Filesystem Size Used Avail Use% Mounted on
/dev/mapper/vg_asusamd64x2boxsu120611-lv_root
50G 5.1G 44G 11% /
tmpfs 1007M 344K 1006M 1% /dev/shm
/dev/sda3 485M 47M 413M 11% /boot
/dev/mapper/vg_asusamd64x2boxsu120611-lv_home
501G 4.4G 472G 1% /home
/dev/sdb2 52G 20G 30G 40% /media/8beb71e7-6b41-4b25-a808-95c1bb3ddbf3
/dev/sdb1 879G 442G 438G 51% /media/32E13CFA21C45329

mount gives:

/dev/mapper/vg_asusamd64x2boxsu120611-lv_root on / type ext4 (rw)
proc on /proc type proc (rw)
sysfs on /sys type sysfs (rw)
devpts on /dev/pts type devpts (rw,gid=5,mode=620)
tmpfs on /dev/shm type tmpfs (rw,rootcontext="system_ubject_r:tmpfs_t:s0")
/dev/sda3 on /boot type ext4 (rw)
/dev/mapper/vg_asusamd64x2boxsu120611-lv_home on /home type ext4 (rw)
none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)
fusectl on /sys/fs/fuse/connections type fusectl (rw)
/dev/sdb2 on /media/8beb71e7-6b41-4b25-a808-95c1bb3ddbf3 type ext2 (rw,nosuid,nodev,uhelper=udisks)
/dev/sdb1 on /media/32E13CFA21C45329 type fuseblk (rw,nosuid,nodev,allow_other,blksize=4096,default_permissions)
gvfs-fuse-daemon on /home/Paul/.gvfs type fuse.gvfs-fuse-daemon (rw,nosuid,nodev,user=Paul)

and dmesg came up with pages of data this being a sample of it:

[ 46.297942] SELinux: initialized (dev sdb2, type ext2), uses xattr
[ 46.583056] EXT2-fs (sdb2): error: ext2_check_page: bad entry in directory #2: : rec_len is smaller than minimal - offset=0, inode=2, rec_len=0, name_len=0
[ 46.764059] EXT2-fs (sdb2): error: ext2_readdir: bad page in #2
[ 46.764802] EXT2-fs (sdb2): error: ext2_readdir: bad page in #2

Thanks again for your help
Paul W
 
Old 06-24-2011, 10:53 PM   #4
pcardout
Member
 
Registered: Jun 2003
Location: Socorro, New Mexico
Distribution: Debian ("jessie", "squeeze"), Linux Mint (Serena), XUbuntu
Posts: 221

Rep: Reputation: 24
Your drive mounts but your file system is damaged. Try fsck.

Your "60 GByte" partition could easily identify itself in
df -h as 52 GBytes (between the 1024-cubed vs. 1000-cubed confusion and the 5% overhead that ext3
"reserves" by default).

So sdb2 is what your external hdd partition is currently identifying as -- and I quote your df -h result here:
/dev/sdb2 52G 20G 30G 40% /media/8beb71e7-6b41-4b25-a808-95c1bb3ddbf3

As you pointed out, it is a partition on a 1 TByte drive, the rest of which shows up here
/dev/sdb1 879G 442G 438G 51% /media/32E13CFA21C45329

I friggin HATE LVM -- it makes everything so hard to read. You do not need to use it. You only need it if you want more than four primary
partitions on the same physical hard drive. If you have multiple drives, the limit is four per each.
There is no reason on god's green earth for your hard drive to be mounted in a directory
called 8beb71e7-6b41-4b25-a808-95c1bb3ddbf3. If you want to know how to set up /etc/fstab by hand, just ask.

But back to your question. Your partition is still there and mounted, but your dmesg, as you probably surmised, is packed with errors.
In such a case, fsck is recommended.

Become root. Then umount /dev/sdb2 (Type mount again and make sure it does not show up. /dev/sdb1 is safe, it's a separate partition).
Then fsck /dev/sdb2.

fsck is scary. It can fix your file system, but used incorrectly (or on a mounted partition) it can trash it thoroughly. So please do some
reading on fsck before going ahead. I think you will successfully recover this damaged partition. There is some risk, but if you do nothing, your
data is gone anyway. Let us know if it worked. If you want advice on fsck, I recommend starting a separate thread posting your dmesg output
first and asking for advice on successfully using fsck.
 
Old 06-25-2011, 12:34 PM   #5
pcardout
Member
 
Registered: Jun 2003
Location: Socorro, New Mexico
Distribution: Debian ("jessie", "squeeze"), Linux Mint (Serena), XUbuntu
Posts: 221

Rep: Reputation: 24
Did you try checking your files from the command line?

Before you run fsck, I wanted to make sure you had tried to look at your files from the command line.

We established that your drive is mounted, despite errors. So open a gnome-terminal and try this.

Code:
cd /media/8beb71e7-6b41-4b25-a808-95c1bb3ddbf3
ls -l
and 
ls -a
If you see some or all of your files, you are good. If you get some sort of error or you see
nothing, well, that's sort of what we expect.
 
Old 06-26-2011, 04:08 AM   #6
PaulFC5
Member
 
Registered: Feb 2008
Location: Auckland, Aotearoa/NZ
Posts: 98

Original Poster
Rep: Reputation: 13
That change directory line came up with

bash: cd: /media/8beb71e7-6b41-4b25-a808-95c1bb3ddbf3: No such file or directory

and your earlier suggestion of the filesystem fix after unmounting it came up with:

[root@ASUSAMD64x2boxSu120611 Paul]# fsck /dev/sdb2
fsck from util-linux-ng 2.18
e2fsck 1.41.12 (17-May-2010)
fsck.ext2: No such file or directory while trying to open /dev/sdb2

The superblock could not be read or does not describe a correct ext2
filesystem. If the device is valid and it really contains an ext2
filesystem (and not swap or ufs or something else), then the superblock
is corrupt, and you might try running e2fsck with an alternate superblock:
e2fsck -b 8193 <device>

and the e2fsck... it suggested came up with the same.

It's very good of you to come up with these ideas.
I know that the simple way is to simply format it and start from zero again - I've got most of the important stuff backed up on other cloned sdds - and I can use the winDoze app to get at anything else that might be important, but I'm using this slightly bothersome little glitch as a way to try and develop my rather feeble understanding of the filesystem setup. Don't much enjoy it when I can't sort out things like this :-)
 
Old 06-26-2011, 04:46 PM   #7
pcardout
Member
 
Registered: Jun 2003
Location: Socorro, New Mexico
Distribution: Debian ("jessie", "squeeze"), Linux Mint (Serena), XUbuntu
Posts: 221

Rep: Reputation: 24
Before you reformat the first partition, check the second one.

Maybe it's time to reformat. I am a little worried about the state of the rest of your 1 TByte drive.
Can you
Code:
cd /media/32E13CFA21C45329
ls -l?
If you want to understand your file system in the future. Don't use LVM, and edit your /etc/fstab yourself to read sensibly.
Here's mine.

Code:
/dev/sda1 /               ext3    errors=remount-ro 0       1
/dev/sda2 /boot           ext3    defaults          0       2
/dev/sda3 none            swap    sw                0       0
/dev/sda4 /home           ext3    defaults          0       2
/dev/sdb4 /backup         ext3    defaults          0       2
Even if you let LVM mess up your system (and I know, it's the default for fedora, etc) you can still take control of your external
drive. The various automated tools are just doing three things.
Formatting (what cfdisk does manually).
and making a file system (what mkfs.ext3 does manually)
and then mounting (editing the /etc/fstab and executing a mount command).

Could guide you through these if you need, but you seem reasonably sophisticated, just read up on the commands and I think you can figure it
out yourself. You seem comfortable with gparted. I guess that's an OK replacement for cfdisk.
 
Old 06-26-2011, 09:06 PM   #8
PaulFC5
Member
 
Registered: Feb 2008
Location: Auckland, Aotearoa/NZ
Posts: 98

Original Poster
Rep: Reputation: 13
Yes - your setup looks a lot simpler and easier to fiddle with, should you need to :-)

ls -l on the ntfs partition came up with everything looking OK - and it r/ws OK too.

The 1TB USB gets very little use and was new only a year or so ago. Just had to get a 1TB when they came down to sensible prices - having started out with a type 4(?) MFM 20meg hdd 20+ years ago and thinking that that was so upmarket :-)
It's a Western Digital - which isn't all that high up the "confidence rankings" - but then, as I'm finding out, the Seagate 5yr guarantee is, in any practical sense, a bit of a waste of time - having had a couple of 500Gs become fairly terminal after about 3 years.

But when do you spose the messup with the sdb2 ext2 partition (presumably it's gotten the wrong UID or something like that) would have happened?
As you say reformatting seems to be the easy answer but it would be good to get a handle on what/when the "mistake" was :-)
My suspicion is that it might have happened when the USB sdb got (accidentally) left on when the box was booting up - and got its MBR overwritten or somehow mucked up.
It's still an ext2 partition and it hasn't gotten itself LVMed - which, like you, I'm begining to see as a bit of a pain.
 
Old 06-26-2011, 11:48 PM   #9
pcardout
Member
 
Registered: Jun 2003
Location: Socorro, New Mexico
Distribution: Debian ("jessie", "squeeze"), Linux Mint (Serena), XUbuntu
Posts: 221

Rep: Reputation: 24
Glad to hear your large partition is still OK.

I can't tell you why your 60 GB partition got messed up. There is no problem booting with an external drive turned on. I do it all the time ... it's something
you should be able to do. I think you had to actively do something (like reformat it, or remake the filesystem).

Quote:
ran a freeware utility called DiskInternals Linux-Recovery from winDoze which, after half an hour, came up with a list showing all the folders and files in the partition. It said that they would be written back onto the hard drive that they were "retrieved" from - but no change happened - still no contents showing when booting up in any linux :-(
I'd be tempted to point my finger at the
Windows rescue software. I assume they knew what they were doing ... but in "rescuing" the drive, they might well have changed it to make your problem worse.

fsck
is the Linux native way to fix a drive ... but in 10 years and 100 systems I have not really seen one stop reading its drive (until they flat out
crash!).

General rule is ... always have a backup. I use rsync and cron and back up one hard drive to another automatically once a week.

Last edited by pcardout; 06-26-2011 at 11:51 PM. Reason: Clarify
 
Old 06-27-2011, 12:19 AM   #10
pcardout
Member
 
Registered: Jun 2003
Location: Socorro, New Mexico
Distribution: Debian ("jessie", "squeeze"), Linux Mint (Serena), XUbuntu
Posts: 221

Rep: Reputation: 24
Smile Practicing with HDD formatting

External drives are great (particularly blank ones) since you can use them to get
very experienced with partitioning, file-system creation, file-system repair, etc.

Since you approached this whole post saying you wanted to learn more about what worked
and what does not work, I recommend you take your external drive, make four different
partitions, format one as NTFS, one as ext3 and maybe another as reiserfs. Mount them
all write to them. Unmount them. Delete them, change them. Have a good old time.
Learn how to edit your /etc/fstab manually ... get through the scary bits about partitioning.
I agree partioning is scary ... because it is the best way to lose "all your stuff".

You'll be much happier when you understand it.
Linux hard-drive management is typically rock solid.

In your case, it looks like your internal drive is /dev/sda (and that mapper/LVM took over some of its partitions).

So long as you always work with sdb, nothing bad can happen to your real data.

I'll say good luck and goodbye on this one. Maybe other LQers who know LVM better than I can help you speculate on what went wrong.
 
Old 06-27-2011, 03:34 PM   #11
Karl Godt
Member
 
Registered: Mar 2010
Location: Kiel , Germany
Distribution: once:SuSE6.2,Debian3.1, aurox9.2+3,Mandrake?,DSL? then:W7st,WVHB, #!8.10.02,PUPPY4.3.1 now:Macpup
Posts: 314

Rep: Reputation: 45
use
Code:
dumppe2fs /dev/sdb2 | grep -i 'backup'
to get available backup blocks .
the output should look like
dumpe2fs /dev/sdc1 | grep -i backup
dumpe2fs 1.41.12 (17-May-2010)
Journal backup: inode blocks
Backup superblock at 32768, Group descriptors at 32769-32769
Backup superblock at 98304, Group descriptors at 98305-98305
Backup superblock at 163840, Group descriptors at 163841-163841
Backup superblock at 229376, Group descriptors at 229377-229377
Backup superblock at 294912, Group descriptors at 294913-294913
Backup superblock at 819200, Group descriptors at 819201-819201
Backup superblock at 884736, Group descriptors at 884737-884737


then run
Code:
fsck -b 884736 /dev/sdb2
And before fsck : check for correct Major/Minor numbers of the drive nodes :
Code:
cat /proc/partitions | grep sdb2
ls -l /dev/sdb2
Code:
cat /proc/partitions | grep sdc1
   8       33    4719616 sdc1
ls -l /dev/sdc1
brw-rw---- 1 root root 8, 33 2011-06-27 22:23 /dev/sdc1
 
1 members found this post helpful.
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Booting Linux on an external USB hard drive (not a memory stick, a hard drive) comcastuser Linux - Hardware 4 01-13-2010 06:59 PM
Copying files from internal Hard drive to USB 2.0 Hard Drive is NOT Behaving tubatodd Ubuntu 4 02-19-2007 04:32 PM
Installing grub to external USB hard drive for later use as internal hard drive dhave Linux From Scratch 2 12-10-2005 08:48 AM
Linux not reading external hard drive tubbablub Linux - Hardware 2 11-19-2005 07:12 PM
Reading Fat32 Hard Drive simplexr Mandriva 7 09-03-2003 12:01 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware

All times are GMT -5. The time now is 12:30 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration