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 08-13-2019, 06:41 AM   #1
TeeSquare
LQ Newbie
 
Registered: Jun 2008
Location: Madras, India
Distribution: Ubuntu 16.04
Posts: 16

Rep: Reputation: 1
Recover data from FAT partition mistakenly reformatted as ext4


I have a Lenovo IP 110 80T70015IH purchased in Nov 2016, with 1TB hard disc which was partitioned as follows:
Primary partitions:
"FreeDOS" 1GB, FAT32- (as originally supplied, remains untouched)
"Windows 7" OS 64GB, NTFS (installed subsequently, and in use)
"Ubuntu 16.04 LTS" 64GB, ext3 (installed subsequently, in regular use)
Extended secondary partitions:
"Linux swap" 8.6GB
**"WinData" 54GB, FAT32 (data files, personal documents, mainly backup from old laptop)**
"HomeTT" 54GB, ext3 (data files and documents in current use)
... Some more partitions filling up the free space, mostly empty, each ~107MB, intended for alternative OS or data groups.
All the above partitioning was achieved using outside help, as my understanding of computer technology is very limited -- I need to be told the exact syntax for using the command line.

**This partition got reformatted by mistake a month ago, into a default ext4 file system under a different name when I inadvertently selected this partition instead of the pen drive, and failed to see the warning messages! It has not been accessed ever since. It is possible that the data is still there intact but remains inaccessible (shown as empty).
If there is a reasonably straightforward procedure for recovering the data in "WinData" and reading the (mostly ".doc", "pdf", "jpg", "htm") files and other stuff in it, I would be grateful for any advice. Please provide the syntax and explanation for any command line work, or recovery software to be installed. If the operation would be too risky for a non-geek I'd rather give up the idea and lose the data, as I don't wish to jeopardise the remaining partitions.
I tried reading the "similar threads" -- many years old, and confusing for me!
Thanks, =TeeSquare=
 
Old 08-13-2019, 06:48 AM   #2
pan64
LQ Guru
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 12,962

Rep: Reputation: 4089Reputation: 4089Reputation: 4089Reputation: 4089Reputation: 4089Reputation: 4089Reputation: 4089Reputation: 4089Reputation: 4089Reputation: 4089Reputation: 4089
the usual way is: dd the partition into a file on another partition and use testdisk to try to recover data from that image. You need additional space to save what was found.
It is not risky at all, if you have enough space to do that.
 
Old 08-13-2019, 11:12 AM   #3
rknichols
Senior Member
 
Registered: Aug 2009
Distribution: CentOS
Posts: 4,248

Rep: Reputation: 1925Reputation: 1925Reputation: 1925Reputation: 1925Reputation: 1925Reputation: 1925Reputation: 1925Reputation: 1925Reputation: 1925Reputation: 1925Reputation: 1925
Quote:
Originally Posted by pan64 View Post
the usual way is: dd the partition into a file on another partition and use testdisk to try to recover data from that image. You need additional space to save what was found.
It is not risky at all, if you have enough space to do that.
Indeed, though you'll probably have to resort to photorec rather than testdisk since much of the old filesystem structure has been overwritten.

Actually, it's reasonably safe to use either testdisk or photorec on the original volume without making a copy, since neither one will write anything to that source volume unless specifically instructed to do so. Making other attempts to "patch up" the original filesystem definitely requires a copy, or at least setting up a Copy-on-Write snapshot device to hold the changes while preserving the original.
 
1 members found this post helpful.
Old 08-13-2019, 05:28 PM   #4
jamison20000e
Senior Member
 
Registered: Nov 2005
Location: ...uncanny valley... infinity\1975; (randomly born:) Milwaukee, WI, US( + travel,) Earth( I wish,) END BORDER$!◣◢┌∩┐ Fe26-E,e...
Distribution: any GPL that works well on my cheapest; has been KDE or CLI but open... http://goo.gl/NqgqJx &c ;-)
Posts: 3,778
Blog Entries: 2

Rep: Reputation: 1285Reputation: 1285Reputation: 1285Reputation: 1285Reputation: 1285Reputation: 1285Reputation: 1285Reputation: 1285Reputation: 1285
Put your back up in and restore the data... maybe next time anyway.

If you have a CD burner or USB drive, external SSD or whatever, use it.
 
1 members found this post helpful.
Old 08-13-2019, 05:30 PM   #5
jamison20000e
Senior Member
 
Registered: Nov 2005
Location: ...uncanny valley... infinity\1975; (randomly born:) Milwaukee, WI, US( + travel,) Earth( I wish,) END BORDER$!◣◢┌∩┐ Fe26-E,e...
Distribution: any GPL that works well on my cheapest; has been KDE or CLI but open... http://goo.gl/NqgqJx &c ;-)
Posts: 3,778
Blog Entries: 2

Rep: Reputation: 1285Reputation: 1285Reputation: 1285Reputation: 1285Reputation: 1285Reputation: 1285Reputation: 1285Reputation: 1285Reputation: 1285
If it's important to me I make many backups.
 
Old 08-13-2019, 11:18 PM   #6
TeeSquare
LQ Newbie
 
Registered: Jun 2008
Location: Madras, India
Distribution: Ubuntu 16.04
Posts: 16

Original Poster
Rep: Reputation: 1
Thanks for the inputs. I'm afraid I'm not confident enough to try it on my own -- age and concentration are not on my side -- I'll get help from someone which may take a week or two, and I'll post the results.
I did try some reading up -- the cgsecurity web site warns me "... you can face a big data loss due to it’s improper usage ... can convert the dd utility as a “data destroyer” for you. That’s why it is recommended that beginners should not use this command on a production machine until they get familiarity on this...."
I'm simply not comfortable with computer technology, being a retired mechanical engineer with an admittedly old-fashioned outlook! I use my pc more like a typewriter, and have little interest in operating systems, though I've learnt to live with Ubuntu and Mint over recent years.
Anyway, for my understanding, does the file system type (FAT, ext4, etc.) of the lost and new partitions restrict the recovery? I have plenty of free space in several unused partitions which were formatted in ext3. So it should be possible to 'duplicate' the contents for trial recovery. Should the target partition be formatted as FAT to start with, since my lost data consists of old Windows files?
Thanks again, =TeeSquare=
 
Old 08-14-2019, 12:30 AM   #7
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 18,013

Rep: Reputation: 2884Reputation: 2884Reputation: 2884Reputation: 2884Reputation: 2884Reputation: 2884Reputation: 2884Reputation: 2884Reputation: 2884Reputation: 2884Reputation: 2884
Quote:
Originally Posted by TeeSquare View Post
Anyway, for my understanding, does the file system type (FAT, ext4, etc.) of the lost and new partitions restrict the recovery? I have plenty of free space in several unused partitions which were formatted in ext3. So it should be possible to 'duplicate' the contents for trial recovery. Should the target partition be formatted as FAT to start with, since my lost data consists of old Windows files?
Thanks again, =TeeSquare=
Doesn't matter - photorec reads the partition a sector at a time looking for fingerprints of known file types (all yours should be recognised). It's "just data" so you can save it in an ext filesystem ok. Simplest is for you to create a new directory (folder) and use that as the output. Photorec will create a bunch of directories under that and create files with sequential names - the original filenames will have been lost when the FAT allocation table got overwritten.
Generally safe to test so long as you ensure you point the target to some other filesystem.
 
1 members found this post helpful.
Old 08-14-2019, 08:38 AM   #8
rknichols
Senior Member
 
Registered: Aug 2009
Distribution: CentOS
Posts: 4,248

Rep: Reputation: 1925Reputation: 1925Reputation: 1925Reputation: 1925Reputation: 1925Reputation: 1925Reputation: 1925Reputation: 1925Reputation: 1925Reputation: 1925Reputation: 1925
There is nothing particularly dangerous about the dd command itself. It's just that it is often used to do dangerous things. You could use the cp command (or, for that matter, "cat >/dev/whatever") to zero the wrong drive just as easily as with dd. That the cp and cat commands do not get the bad reputation is just because they are not typically used to do that sort of thing.
 
Old 08-14-2019, 09:30 AM   #9
TeeSquare
LQ Newbie
 
Registered: Jun 2008
Location: Madras, India
Distribution: Ubuntu 16.04
Posts: 16

Original Poster
Rep: Reputation: 1
Thank you pan64, rknichols, and especially syg00 for your inputs and clarifications. I now have some understanding of what happens and how, but will defer the operation till I can get some help to execute it, for reasons already mentioned, mainly being a novice with the command line! Anyway I hope to post a SOLVED response in due course.
The current problem is not too urgent, and there are other distractions demanding my attention, such as getting advice on use of a new laptop, for which I'll post some queries in the general section. =TeeSquare=
 
  


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
Recover Partition which was type:fuseblk and mistakenly formatted to type vfat thilinakasun Linux - General 4 07-13-2013 01:03 PM
Recovering files from reformatted FAT in linux ensa Linux - General 6 07-22-2007 04:25 PM
How to recover files mistakenly deleted from Kget? duffmckagan Linux - Software 3 12-07-2005 10:17 AM
TROUBLE: MISTAKENLY CHANGED PERMISSION OF OS . how to recover mallinath Linux - Newbie 4 06-29-2005 03:21 PM
Recovering Data From A Freshly Reformatted Ext3 Partition johnleemk Linux - Hardware 1 02-04-2004 01:48 AM

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

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