LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 06-13-2013, 02:37 AM   #1
qwertyjjj
Senior Member
 
Registered: Jul 2009
Location: UK
Distribution: Cent OS5 with Plesk
Posts: 1,012

Rep: Reputation: 30
external usb will not mount


computer crashed and now the external usb won't mount.
i tried repairing but it still doesn't work:

Quote:
hh@spain ~ $ mount /dev/sdc /mnt/temp
mount: only root can do that
hh@spain ~ $ sudo mount /dev/sdc /mnt/temp
[sudo] password for hh:
mount: mount point /mnt/temp does not exist
hh@spain ~ $ mkdir /mnt/temp
mkdir: cannot create directory `/mnt/temp': Permission denied
hh@spain ~ $ sudo mkdir /mnt/temp
hh@spain ~ $ sudo mount /dev/sdc /mnt/temp
mount: you must specify the filesystem type
hh@spain ~ $ sudo mount /dev/sdc /mnt/temp -t ext2
mount: wrong fs type, bad option, bad superblock on /dev/sdc,
missing codepage or helper program, or other error
In some cases useful info is found in syslog - try
dmesg | tail or so

hh@spain ~ $ dumpe2fs /dev/sdc | grep superblock
dumpe2fs 1.42.5 (29-Jul-2012)
dumpe2fs: Permission denied while trying to open /dev/sdc
Couldn't find valid filesystem superblock.
hh@spain ~ $ sudo dumpe2fs /dev/sdc | grep superblock
dumpe2fs 1.42.5 (29-Jul-2012)
dumpe2fs: Bad magic number in super-block while trying to open /dev/sdc
Couldn't find valid filesystem superblock.
hh@spain ~ $ mke2fs /dev/hda
mke2fs 1.42.5 (29-Jul-2012)
Could not stat /dev/hda --- No such file or directory

The device apparently does not exist; did you specify it correctly?
hh@spain ~ $ mke2fs /dev/sdc
mke2fs 1.42.5 (29-Jul-2012)
/dev/sdc is entire device, not just one partition!
Proceed anyway? (y,n) y
mke2fs: Permission denied while trying to determine filesystem size
hh@spain ~ $ sudo mke2fs /dev/sdc
mke2fs 1.42.5 (29-Jul-2012)
/dev/sdc is entire device, not just one partition!
Proceed anyway? (y,n) y
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
30531584 inodes, 122096646 blocks
6104832 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=0
3727 block groups
32768 blocks per group, 32768 fragments per group
8192 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
4096000, 7962624, 11239424, 20480000, 23887872, 71663616, 78675968,
102400000

Allocating group tables: done
Writing inode tables: done
Writing superblocks and filesystem accounting information: done

hh@spain ~ $ sudo fsck -b 32768 /dev/sdc
fsck from util-linux 2.20.1
e2fsck 1.42.5 (29-Jul-2012)
/dev/sdc was not cleanly unmounted, check forced.
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information

/dev/sdc: ***** FILE SYSTEM WAS MODIFIED *****
/dev/sdc: 11/30531584 files (0.0% non-contiguous), 1934134/122096646 blocks
hh@spain ~ $ sudo mount /dev/sdc /mnt/temp
hh@spain ~ $ cd /mnt/temp
hh@spain /mnt/temp $ ls -l
ls: cannot access lost+found: Input/output error
total 0
d????????? ? ? ? ? ? lost+found
hh@spain /mnt/temp $ cd lost+found
bash: cd: lost+found: Input/output error
hh@spain /mnt/temp $ cd lost*
bash: cd: lost+found: Input/output error
hh@spain /mnt/temp $
 
Old 06-13-2013, 04:08 AM   #2
spazticclown
Member
 
Registered: Sep 2010
Distribution: Fedora, Android, CentOS
Posts: 91
Blog Entries: 2

Rep: Reputation: 21
Most likely the hard drive had a partition table and the partition would have been sdc1 not sdc.

You can check for a partition table with
Code:
$ sudo fdisk -l /dev/sdc
From here you may need to repair the partition table, the file system or attempt data recovery. The attempt to repair the file system may have damaged the partition table, the actual file system or both.
 
Old 06-13-2013, 05:03 AM   #3
mddnix
Member
 
Registered: Mar 2013
Distribution: Redhat, Ubuntu
Posts: 525

Rep: Reputation: 141Reputation: 141
you can only mount file system, not disk itself. first check the partition(s) number and the file system type that are on that partition. you can do that by issuing "fdisk /dev/sdc -l". you get the file system type under 'System' header. generally you dont have to specify file system type for known ones.

For example:
Code:
# fdisk -l /dev/sdd

Disk /dev/sdd: 16.0 GB, 16008609792 bytes
68 heads, 41 sectors/track, 11214 cylinders
Units = cylinders of 2788 * 512 = 1427456 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x1acf80f3

   Device Boot      Start         End      Blocks   Id  System
/dev/sdd1               1       11214    15630336    7  HPFS/NTFS
Then mount the file system
Code:
# mkdir -p /mnt/temp
# mount /dev/sdd1 /mnt/temp
Edit: you can also use blkid command.
Code:
# blkid
/dev/sdd1: LABEL="Madhu_USB" UUID="ABDC63B2DB03D21A" TYPE="ntfs"

Last edited by mddnix; 06-13-2013 at 05:21 AM.
 
Old 06-14-2013, 02:39 AM   #4
qwertyjjj
Senior Member
 
Registered: Jul 2009
Location: UK
Distribution: Cent OS5 with Plesk
Posts: 1,012

Original Poster
Rep: Reputation: 30
Quote:
Originally Posted by mddesai View Post
you can only mount file system, not disk itself. first check the partition(s) number and the file system type that are on that partition. you can do that by issuing "fdisk /dev/sdc -l". you get the file system type under 'System' header. generally you dont have to specify file system type for known ones.

For example:
Code:
# fdisk -l /dev/sdd

Disk /dev/sdd: 16.0 GB, 16008609792 bytes
68 heads, 41 sectors/track, 11214 cylinders
Units = cylinders of 2788 * 512 = 1427456 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x1acf80f3

   Device Boot      Start         End      Blocks   Id  System
/dev/sdd1               1       11214    15630336    7  HPFS/NTFS
Then mount the file system
Code:
# mkdir -p /mnt/temp
# mount /dev/sdd1 /mnt/temp
Edit: you can also use blkid command.
Code:
# blkid
/dev/sdd1: LABEL="Madhu_USB" UUID="ABDC63B2DB03D21A" TYPE="ntfs"
right now it automounts but with a lost+found folder with nothing in it

Quote:
hh@spain ~ $ fdisk -l /dev/sdc
Cannot open /dev/sdc
hh@spain ~ $ df
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/sdb1 15388032 9257492 5348872 64% /
udev 1998092 4 1998088 1% /dev
tmpfs 803532 1088 802444 1% /run
none 5120 0 5120 0% /run/lock
none 2008828 776 2008052 1% /run/shm
none 102400 16 102384 1% /run/user
/home/spain/.Private 15388032 9257492 5348872 64% /home/spain
/dev/mmcblk0p1 969408 192240 777168 20% /media/hh/1994-5DA0
/dev/sdc 480721640 71592 456230720 1% /media/hh/e939af5c-0a7b-43c1-8185-2949bc649a20
hh@spain ~ $ fdisk -l /dev/sdc1
hh@spain ~ $ blkid
hh@spain ~ $


---------- Post added 06-14-13 at 02:40 AM ----------

hh@spain ~ $ sudo fdisk -l /dev/sdc

Disk /dev/sdc: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 cylinders, total 976773168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

Disk /dev/sdc doesn't contain a valid partition table
jashhon@spain ~ $
 
Old 06-14-2013, 04:48 AM   #5
mddnix
Member
 
Registered: Mar 2013
Distribution: Redhat, Ubuntu
Posts: 525

Rep: Reputation: 141Reputation: 141
Quote:
Originally Posted by qwertyjjj View Post
hh@spain ~ $ sudo fdisk -l /dev/sdc

Disk /dev/sdc: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 cylinders, total 976773168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

Disk /dev/sdc doesn't contain a valid partition table
jashhon@spain ~ $
It clearly show there are no partition, so there is no point in mounting anything. I am not sure what you actually want to do. are you trying to recover data from usb? or just want to mount usb. by looking at post #1, you are trying to mount, format, repair, dump and search superblock as regular and superuser randomly without much thought put into it.

i assume you want to mount usb drive. if i got it wrong, let me know.

1. Create partition: You can only have maximum of four primary partitions (with no extended partition) on a device. If you need more than four partitions, you can have three primary partitions, one extended partition, and multiple logical partitions within the extended.

2. Mark the partition to type Linux (hex code 83)

3. Format partition to file system type like ext2, ext3, ext4, xfs etc. (mkfs.ext4 -L "Any Name" /dev/sdcX)

4. Mount the file system (not device). if you have just one partition, then it will be /dev/sdc1. most of the disk operations are done to file systems, not to device itself.

This may help you: How to Use Fdisk to Manage Partitions on Linux

Cheers!!!

Last edited by mddnix; 06-14-2013 at 04:54 AM.
 
Old 06-14-2013, 12:30 PM   #6
qwertyjjj
Senior Member
 
Registered: Jul 2009
Location: UK
Distribution: Cent OS5 with Plesk
Posts: 1,012

Original Poster
Rep: Reputation: 30
Quote:
Originally Posted by mddesai View Post

i assume you want to mount usb drive. if i got it wrong, let me know.
Hi, no the drive had about 100GB of data on it. There was a system crash and when I next plugged it in, it would not automount.
I could not see any data either.
So, I need to repair it and get the files back.
 
Old 06-14-2013, 01:19 PM   #7
michaelk
Moderator
 
Registered: Aug 2002
Posts: 15,738

Rep: Reputation: 1753Reputation: 1753Reputation: 1753Reputation: 1753Reputation: 1753Reputation: 1753Reputation: 1753Reputation: 1753Reputation: 1753Reputation: 1753Reputation: 1753
Quote:
hh@spain ~ $ sudo mke2fs /dev/sdc
mke2fs 1.42.5 (29-Jul-2012)
/dev/sdc is entire device, not just one partition!
Proceed anyway? (y,n) y
Quote:
/dev/sdc 480721640 71592 456230720 1% /media/hh/e939af5c-0a7b-43c1-8185-2949bc649a20]
The entire drive was formatted as a single file system so the existing partition table was overwritten so it is possible in this case to mount a disk. It does not mean the drive can not be mounted or used as is since it is already mounted as posted.

Since you created a new file system all you will see is a lost+found directory. It is to late to repair. You will need to use some data recovery tools like photorec or testdisk to try to get the files back. It is advisable to create a disk image if possible so that while trying to recovery files the files are not further corrupted.
 
Old 06-14-2013, 01:22 PM   #8
mddnix
Member
 
Registered: Mar 2013
Distribution: Redhat, Ubuntu
Posts: 525

Rep: Reputation: 141Reputation: 141
Quote:
Originally Posted by qwertyjjj View Post
Hi, no the drive had about 100GB of data on it. There was a system crash and when I next plugged it in, it would not automount.
I could not see any data either.
So, I need to repair it and get the files back.
Try TestDisk. I personally have never used it, but have overheard it several times that it gives very good results.

If you are using rhel/centos/fedora, it is available in epel and rpmforge repository.

If you have other distro,
1. Goto Linux Packages Search
2. At top-right cornet in search textbox enter 'testdisk' and choose your linux distro.
3. Choose version
4. Get instruction to install in 'Install Howto' section.

Hope it works for you.

Edit: Have a look at Recover deleted partitions using Testdisk in Ubuntu in Youtube.

Last edited by mddnix; 06-14-2013 at 01:26 PM.
 
Old 06-14-2013, 01:29 PM   #9
suicidaleggroll
LQ Guru
 
Registered: Nov 2010
Location: Colorado
Distribution: OpenSUSE, CentOS
Posts: 5,465

Rep: Reputation: 2069Reputation: 2069Reputation: 2069Reputation: 2069Reputation: 2069Reputation: 2069Reputation: 2069Reputation: 2069Reputation: 2069Reputation: 2069Reputation: 2069
The sequence of commands you ran in the OP show me that you really don't know what you're doing and you have no concern for the integrity of this data that you claim you want to recover. You need to back up and take things one step at a time. Learn what you're about to do BEFORE you do it. Reading through the commands you were running given your original question gave me the shivers...you're just blasting through low level reformatting commands and ignoring all errors that are trying to warn you that what you're doing is wrong.

Now, stop everything. Stop running mke2fs, stop trying to re-format the drive. You will never recover your data that way, the only thing you're going to do is wipe the drive. The power outage caused the partition table on the drive to become corrupted. You need to RECOVER the partition or the files on it, not reformat the drive and make a new partition.

Now that you've stopped corrupting the drive even more, run testdisk to try to recover what files might be left.

Last edited by suicidaleggroll; 06-14-2013 at 01:32 PM.
 
Old 06-16-2013, 03:47 AM   #10
qwertyjjj
Senior Member
 
Registered: Jul 2009
Location: UK
Distribution: Cent OS5 with Plesk
Posts: 1,012

Original Poster
Rep: Reputation: 30
not looking promising.
the files it finds all have strange characters in the file name.
when I run it, it finds no partitions so I select None in the menu.
I could use photorec maybe?

Quote:
TestDisk 6.13, Data Recovery Utility, November 2011
Christophe GRENIER <grenier@cgsecurity.org>
http://www.cgsecurity.org

Disk /dev/sdc - 500 GB / 465 GiB - CHS 60801 255 63

The harddisk (500 GB / 465 GiB) seems too small! (< 14118232 TB / 12840457 TiB)
Check the harddisk size: HD jumpers settings, BIOS detection...

The following partitions can't be recovered:
Partition Start End Size in sectors
> HFS 8434 168 52 243830 8 17 3781626626 [^C]
JFS 10162 203 7 3270376325 135 29 9505353429007213
UFS 2 12807 225 27 73348 27 31 972578696
UFS 2 12807 227 13 73348 29 17 972578696
UFS 2 13845 150 2 74385 207 6 972578696
UFS 2 13845 151 51 74385 208 55 972578696
UFS 2 17241 181 29 77781 238 33 972578696
UFS 2 17241 183 15 77781 240 19 972578696
HFS 19960 210 38 95277 227 10 1209968649 [ttach~@mentTyp\^?
HFS 19961 230 41 95278 247 13 1209968649 [ttach~@mentTyp\^?
^?^?]
[ Continue ]
HFS, 1936 GB / 1803 GiB



drwxr-xr-x 0 0 162300419 3-Dec-1934 16:53 M-?M-HM-aM-~~.
-rwxr-xr-x 0 0 2616783034 8-Jan-1989 22:14 x ~\M-'/^NM-!.~RnN
-r-xr-xr-x 0 0 550105258 26-Apr-1950 16:00 ~A^VM-:z^EϩM-,.
-rwxr-xr-x 0 0 2919222749 27-Sep-2019 06:59 d~_D~Z.M-?I;
-r-xr-xr-x 0 0 2429051755 24-Mar-2009 11:03 M-/bM-GM-K~_~?.W~J
drwxr-xr-x 0 0 3318935722 13-Oct-1963 22:53 wM-/M-Z]kc M-8wx
-r-xr-xr-x 0 0 3470476967 19-Jun-1968 23:07 t82E~@~Y^S.Ǒ
drwxr-xr-x 0 0 3044301917 2-Sep-1993 22:46 M-pᬁ_~ vM-d
-rwxr-xr-x 0 0 4116811307 7-Dec-2032 11:13 ^RM-"M-8m
drwxr-xr-x 0 0 4134002576 23-Oct-1961 09:38 M-W жM-o.M-'9^D
dr-xr-xr-x 0 0 3492343276 6-Oct-2031 04:03 s^OM-kjM-F.M-rM-5
-rwxr-xr-x 0 0 2335154072 16-May-1940 13:07 1&kV^G ~R~\M-!
-r-xr-xr-x 0 0 221657556 25-Apr-1929 08:28 .i^S~V
-r-xr-xr-x 0 0 2476058484 24-Jan-1995 11:51 {M-*& M- .Pʎ
drwxr-xr-x 0 0 2436475767 16-Aug-2020 00:34 ~P#^A^F1^K;M-!.ST^E
-rwxr-xr-x 0 0 712182061 30-Sep-1910 09:52 M-,M-q`e2w^U.M-~M-a
dr-xr-xr-x 0 0 2461505703 4-Dec-1902 07:59 M-(M-=M-zM-eM-~ M-'M-4^A
-rwxr-xr-x 0 0 3580449050 9-Jan-2037 17:27 ~N~NM-$0M-d~LM-7.^G^W
dr-xr-xr-x 0 0 3603930798 18-Nov-1992 18:43 E M-+n M-*.M~A
drwxr-xr-x 0 0 4035243761 17-Dec-2030 09:59 T,qaM-,M-@~?.^O^W~U
drwxr-xr-x 0 0 1198123208 7-Jan-1985 04:02 EnM-<Ք 5LM-$
-rwxr-xr-x 0 0 2778729214 25-Apr-1905 23:42 ^OM-wM-"M-}
dr-xr-xr-x 0 0 659528362 30-Mar-1960 21:37 =0^_M-- 7M-4~L
-rwxr-xr-x 0 0 1494765073 1-Dec-1948 18:24 'VM-+M-xOM-M.M-F0
drwxr-xr-x 0 0 3635727934 21-Sep-1955 17:18 M-@M-,M-,^_~ ^?M-.
dr-xr-xr-x 0 0 2966745337 3-Mar-2025 17:05 M-$Y~YN~\~IM-94.CQY
drwxr-xr-x 0 0 3130343234 18-Jan-2018 21:02 l ^Ve)35.M->'
dr-xr-xr-x 0 0 2028998406 2-Mar-1980 17:36 M-&~\M-:t~EM-LK.H^\&
-rwxr-xr-x 0 0 4011777865 16-Jan-2002 19:04 YM-hf&w .M-<M-6~U
-r-xr-xr-x 0 0 2035926795 30-Jun-1944 05:53 ^Sl^NM-UQM-(.$^K"
dr-xr-xr-x 0 0 215636585 7-Jan-1999 15:00 ^V~[~_K6V.^\cM-4
dr-xr-xr-x 0 0 1893154604 5-Feb-2030 21:19 ~Q,r^? M-73.M-#;~G
dr-xr-xr-x 0 0 1324006309 6-May-1920 06:21 Cbjs0~].^\~I,
>drwxr-xr-x 0 0 125465908 8-Feb-2021 09:52 NM-eM- ^T~?~J~U.M-%$W

Last edited by qwertyjjj; 06-16-2013 at 03:48 AM.
 
Old 06-19-2013, 01:44 AM   #11
spazticclown
Member
 
Registered: Sep 2010
Distribution: Fedora, Android, CentOS
Posts: 91
Blog Entries: 2

Rep: Reputation: 21
The data may be lost at this point. If you want to continue recoveries I would recommend foremost or scalpel to attempt to recover files based on the headers. This is very time and space consuming. These tools will scan the surface of the drive looking for data that matches pre-defined patterns for file headers and will read these files off onto another drive until it reaches the end of the file. If a file has been partially written over with a new file you may end up with very large bogus files on the recovery media. This method can recover fragments of files previously deleted, web cache files etc that you never knew existed and will recover a huge amount of junk data. When running these tools for customers I normally get 4-8x the original drive size in recovered files without any relevant file names or directory structure to be assessed.

I am not going to give you an example of how to run these utilities as they are fairly complex, you will have to tune them to the type of data you are attempting to recover (jpg, mov, avi, odf, etc). I have found many guides through a google search.

Last edited by spazticclown; 06-19-2013 at 01:45 AM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Mount External USB CDROM sadock Red Hat 1 08-24-2011 03:18 PM
mount external usb disc eggerola Linux - Newbie 8 09-30-2009 01:35 PM
Slackware 10.2 Cannot mount USB HD (external) beowulf71 Slackware 9 06-11-2006 02:54 PM
How to mount an external USB HD? Thakowbbery Linux - Hardware 1 05-18-2006 08:20 AM
can't mount external usb hd jnsenit Linux - Hardware 2 12-03-2004 03:03 PM


All times are GMT -5. The time now is 04:27 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration