LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
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 10-17-2015, 08:27 PM   #16
remn
Member
 
Registered: Jun 2015
Posts: 37

Original Poster
Rep: Reputation: Disabled

I'm trying to use the "gpart" utility from the tutorial you linked. I ran *sudo gpart -W /dev/sdb /dev/sdb* and got the following output:

****************************************************

Begin scan...
Possible partition(Windows NT/W2K FS), size(3mb), offset(16mb)
Possible partition(Windows NT/W2K FS), size(0mb), offset(19mb)
End scan.

Checking partitions...
Partition(OS/2 HPFS, NTFS, QNX or Advanced UNIX): primary
Partition(OS/2 HPFS, NTFS, QNX or Advanced UNIX): primary
Ok.

Guessed primary partition table:
Primary partition(1)
type: 007(0x07)(OS/2 HPFS, NTFS, QNX or Advanced UNIX)
size: 3mb #s(6173) s(33976-40148)
chs: (2/66/1)-(2/165/35)d (2/66/1)-(2/165/35)r

Primary partition(2)
type: 007(0x07)(OS/2 HPFS, NTFS, QNX or Advanced UNIX)
size: 0mb #s(1) s(40272-40272)
chs: (2/167/35)-(2/167/35)d (2/167/35)-(2/167/35)r

Primary partition(3)
type: 000(0x00)(unused)
size: 0mb #s(0) s(0-0)
chs: (0/0/0)-(0/0/0)d (0/0/0)-(0/0/0)r

Primary partition(4)
type: 000(0x00)(unused)
size: 0mb #s(0) s(0-0)
chs: (0/0/0)-(0/0/0)d (0/0/0)-(0/0/0)r

Edit this table (y,n) :

*****************************************************

Not sure what to do from there, or if this option will work. It seems like it only found a single partition of 3MB, and a few more partitions of 0MB?? It's an 8GB usb drive.
 
Old 10-17-2015, 08:50 PM   #17
remn
Member
 
Registered: Jun 2015
Posts: 37

Original Poster
Rep: Reputation: Disabled
Deleted double post
 
Old 10-17-2015, 09:09 PM   #18
ferrari
LQ Guru
 
Registered: Sep 2003
Location: Auckland, NZ
Distribution: openSUSE Leap
Posts: 5,791

Rep: Reputation: 1140Reputation: 1140Reputation: 1140Reputation: 1140Reputation: 1140Reputation: 1140Reputation: 1140Reputation: 1140Reputation: 1140
Others may be able to advise further regarding the use of gpart to try to recover the partition. I have my doubts about this, but so long as you have made your backup image, you have nothing to lose I guess. Instead, I would try using foremost to attempt file recovery. The wiki suggests doing this from the backup image itself. It's only using read operations, so there should be no risk with this approach.
 
Old 10-17-2015, 10:56 PM   #19
maples
Member
 
Registered: Oct 2013
Location: IN, USA
Distribution: Arch, Debian Jessie
Posts: 814

Rep: Reputation: 265Reputation: 265Reputation: 265
Can you post the output of
Code:
sudo blkid
Also, have you heard of the tool Gparted? (which is very different from gpart)

Last edited by maples; 10-17-2015 at 11:01 PM.
 
Old 10-18-2015, 12:06 PM   #20
remn
Member
 
Registered: Jun 2015
Posts: 37

Original Poster
Rep: Reputation: Disabled
I just tried Gparted and the result was similar to gpart. It found 1 3MB NTFS partition and 1 0MB NTFS partition. So it looks like the filesystem was/is NTFS, but I don't know what's up with the weird 3MB size. I'll try foremost next and report back.
 
Old 10-18-2015, 05:10 PM   #21
maples
Member
 
Registered: Oct 2013
Location: IN, USA
Distribution: Arch, Debian Jessie
Posts: 814

Rep: Reputation: 265Reputation: 265Reputation: 265
Quote:
Originally Posted by remn View Post
I just tried Gparted and the result was similar to gpart. It found 1 3MB NTFS partition and 1 0MB NTFS partition. So it looks like the filesystem was/is NTFS, but I don't know what's up with the weird 3MB size. I'll try foremost next and report back.
If you have everything backed up, I would suggest just deleting all of the partitions and creating a new NTFS one.

However, make sure that you're using the right disk! Double- and triple-check that sdb corresponds to the USB disk that you just inserted, and not some other disk (Does your printer have an SD-card reader? Do you have your phone plugged in? Is your mp3 player connected?). I would highly recommend completely disconnecting anything and everything that could potentially be some form of drive before proceeding. And then make sure that you're using the USB disk and not your internal hard drive.

I know that it can seem like a lot just to format a flash drive, but you'd be surprised. I've done something like this before, when I was adding a hard drive to my desktop. Fortunately, I keep pretty good backups, but it's a lot easier to seriously screw up than you think it is.
 
Old 10-18-2015, 05:41 PM   #22
TobiSGD
Moderator
 
Registered: Dec 2009
Location: Germany
Distribution: Whatever fits the task best
Posts: 17,148
Blog Entries: 2

Rep: Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886
Quote:
Originally Posted by ferrari View Post
If you can't recover the file system, all hope is not lost. You can work with the device or backup you created to try to recover the files using a utility like foremost.

Read this excellent data recovery guide
https://help.ubuntu.com/community/DataRecovery

This might help too
http://www.levlafayette.com/node/20
Foremost development stopped in 2008, I recommend to use Photorec (part of the Testdisk package) instead.
 
Old 10-18-2015, 06:04 PM   #23
ferrari
LQ Guru
 
Registered: Sep 2003
Location: Auckland, NZ
Distribution: openSUSE Leap
Posts: 5,791

Rep: Reputation: 1140Reputation: 1140Reputation: 1140Reputation: 1140Reputation: 1140Reputation: 1140Reputation: 1140Reputation: 1140Reputation: 1140
Quote:
Foremost development stopped in 2008, I recommend to use Photorec (part of the Testdisk package) instead.
Good to know. Thanks for the advice.
 
Old 10-24-2015, 02:21 PM   #24
remn
Member
 
Registered: Jun 2015
Posts: 37

Original Poster
Rep: Reputation: Disabled
Thanks for the help everybody, I was able to recover the files with photorec. Even though that program does recover different file types, I can see why it's called photorec. The files on my drive were mostly music files located in album directories. Although I got the files back, there are no file names and all the directories are lost, so I have a ton of .flac files all jumbled into a single directory with no artist/title info. The metadata is still there though, because when I play them all the info turns up on the player. I'll have to see if I can find a quick way to get them all re-organized.

Anyway, very glad to be able to recover the data, thanks again!
 
Old 10-24-2015, 03:04 PM   #25
TobiSGD
Moderator
 
Registered: Dec 2009
Location: Germany
Distribution: Whatever fits the task best
Posts: 17,148
Blog Entries: 2

Rep: Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886
Quote:
Originally Posted by remn View Post
The files on my drive were mostly music files located in album directories. Although I got the files back, there are no file names and all the directories are lost, so I have a ton of .flac files all jumbled into a single directory with no artist/title info.
This is expected behavior, since file carving tools like Photorec ignore filesystem information (which stores filenames) and purely extract the files they can find.
Quote:
The metadata is still there though, because when I play them all the info turns up on the player. I'll have to see if I can find a quick way to get them all re-organized.
I am sure that there are specialized tools for that, but you could also write a script to do this. Metadata from FLAC files can easily be extracted using the metaflac tool, which comes in the flac package that most distributions should have in their repositories. For example:
Code:
metaflac --export-tags-to=- $FILENAME
will show you all tags in the metadata. Single tags, like ARTIST or TITLE can be extracted with the --show-tag option, for example
Code:
metaflac --show-tag TITLE $FILENAME
will show you the title of the track. It shouldn't be hard to use that information to write a script that generates meaningful filenames to be used to rename the files.
 
  


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
[SOLVED] Usb flash drive error: Unable to read mount point hewjr1000 Linux - Newbie 4 11-18-2010 05:59 PM
Unable to mount USB flash drive in SuSE 10.1 David Gaguine SUSE / openSUSE 5 11-20-2007 11:54 AM
when i mount my USB Flash Drive A Messenge has come that mount: can't find /dev/sda/h feda82 Red Hat 2 12-24-2005 07:16 AM
when i mount my USB Flash Drive A Messenge has come that mount: can't find /dev/sda/h feda82 Red Hat 1 12-24-2005 04:25 AM
when i mount my USB Flash Drive A Messenge has come that mount: can't find /dev/sda/h feda82 Red Hat 2 12-24-2005 02:15 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 02:46 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