Urgent help needed for partition recovery.

Quick to answer questions about finding your way around Linux Mint as a new user.
Forum rules
There are no such things as "stupid" questions. However if you think your question is a bit stupid, then this is the right place for you to post it. Stick to easy to-the-point questions that you feel people can answer fast. For long and complicated questions use the other forums in the support section.
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
Locked
globetrotterdk

Urgent help needed for partition recovery.

Post by globetrotterdk »

In the process of re-organizing my system and installing Linux Mint 15 XFCE, I accidently reformatted my /dev/sda6 partition from ext4 to xfs and lost my /home partition information in the process. I am trying to recover the partition by using my Linux Mint 15 XFCE install DVD. I am using [url=http://help.ubuntu.com/community/DataRecovery]this[/url] Ubuntu Data Recovery documentation.
I have done the following so far:

Code: Select all

sudo swapoff -a

Code: Select all

sudo parted /dev/sda
Unfortunately I couldn't figure out how to use the "rescue" option. I know that my /home partition is 887.47 GB and I believe the first sector is at 92368896 and the last sector is at 1953523711.
I have tried

Code: Select all

sudo testdisk
but am unsure what to do to get this to work. The log file reports the following:
Compilation date: 2013-02-16T06:51:40
ext2fs lib: 1.42.5, ntfs lib: libntfs-3g, reiserfs lib: none, ewf lib: none
/dev/sda: LBA, HPA, LBA48 support
/dev/sda: size 1953525168 sectors
/dev/sda: user_max 1953525168 sectors
/dev/sda: native_max 1953525168 sectors
----
(and further on)
----
Hard disk list
Disk /dev/sda - 1000 GB / 931 GiB - CHS 121601 255 63, sector size=512 - WDC WD1002FAEX-00Y9A0, S/N:WD-WCAW30125528, FW:05.01D05
----
(and further on)
----
Partition table type (auto): Intel
Disk /dev/sda - 1000 GB / 931 GiB - WDC WD1002FAEX-00Y9A0
Partition table type: EFI GPT

Analyse Disk /dev/sda - 1000 GB / 931 GiB - CHS 121601 255 63
Current partition structure:
Bad GPT partition, invalid signature.

search_part()
Disk /dev/sda - 1000 GB / 931 GiB - CHS 121601 255 63

recover_EXT2: s_block_group_nr=0/230, s_mnt_count=183/4294967295, s_blocks_per_group=32768, s_inodes_per_group=8144
recover_EXT2: s_blocksize=4096
recover_EXT2: s_blocks_count 7560448
recover_EXT2: part_size 60483584
MS Data 2048 60485631 60483584
EXT4 Large file Sparse superblock, 30 GB / 28 GiB
Linux Swap 60493824 92366831 31873008
SWAP2 version 1, 16 GB / 15 GiB

XFS Marker at 5749/177/61

recover_xfs
MS Data 92368896 1953523711 1861154816
XFS 6.2+ - bitmap version, 952 GB / 887 GiB

Results
P MS Data 2048 60485631 60483584
EXT4 Large file Sparse superblock, 30 GB / 28 GiB
P Linux Swap 60493824 92366831 31873008
SWAP2 version 1, 16 GB / 15 GiB
P MS Data 92368896 1953523711 1861154816
XFS 6.2+ - bitmap version, 952 GB / 887 GiB

interface_write()
1 P MS Data 2048 60485631 60483584
2 P Linux Swap 60493824 92366831 31873008
3 P MS Data 92368896 1953523711 1861154816

search_part()
Disk /dev/sda - 1000 GB / 931 GiB - CHS 121601 255 63

recover_EXT2: s_block_group_nr=0/230, s_mnt_count=183/4294967295, s_blocks_per_group=32768, s_inodes_per_group=8144
recover_EXT2: s_blocksize=4096
recover_EXT2: s_blocks_count 7560448
recover_EXT2: part_size 60483584
MS Data 2048 60485631 60483584
EXT4 Large file Sparse superblock, 30 GB / 28 GiB

block_group_nr 1
I have used gddrescue as well. Here is the contents of the logfile:
# Rescue Logfile. Created by GNU ddrescue version 1.16
# Command line: ddrescue -r 3 /dev/sda /media/mint/MyBook/image /media/mint/MyBook/logfile
# current_pos current_status
0xE8E0DB0000 +
# pos size status
0x00000000 0xE8E0DB6000 +
gddrescue created an image file with no errors. I have tried using mmls to get the "offset" information needed to mount the partition from the image ("image" is the default name of the file created by gddrescue, but I guess I could have given it another name.):

Code: Select all

$ sudo mmls image -b
mmls: option requires an argument -- 'b'
Unknown argument
I am not really sure where to go from here. I don't have any experience with this and I would just like to recover the partition if possible, but if not, at least recover my emails and some of my most important files and pictures, so that I can get my Linux Mint install working (on another HD).

Anyone out there that can help?
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 1 time in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
User avatar
Spearmint2
Level 16
Level 16
Posts: 6900
Joined: Sat May 04, 2013 1:41 pm
Location: Maryland, USA

Re: Urgent help needed for partition recovery.

Post by Spearmint2 »

Here's a completely wild idea and I have no idea if it would work. Create a larger partition on a drive that has the formatting you want. Open GParted and do a copy of the affected partition, then paste into the other partition. See if it can be accessed at all then. If not, then run FSCK on the drive while unmounted and then see if it can be accessed and files seen.
All things go better with Mint. Mint julep, mint jelly, mint gum, candy mints, pillow mints, peppermint, chocolate mints, spearmint,....
globetrotterdk

Re: Urgent help needed for partition recovery.

Post by globetrotterdk »

Spearmint2 wrote:Here's a completely wild idea and I have no idea if it would work. Create a larger partition on a drive that has the formatting you want. Open GParted and do a copy of the affected partition, then paste into the other partition. See if it can be accessed at all then. If not, then run FSCK on the drive while unmounted and then see if it can be accessed and files seen.
I have been thinking about doing something similar - trying to copy the partition from a Clonezilla live-CD. At least that way I could be fairly shure that the partition isn't being written to.
srs5694
Level 6
Level 6
Posts: 1386
Joined: Mon Feb 27, 2012 1:42 pm

Re: Urgent help needed for partition recovery.

Post by srs5694 »

Doing a low-level copy of the partition will accomplish nothing, I'm afraid, except to create a backup for recovery to the current state should subsequent efforts make matters worse. (This is worthwhile, but won't fix anything by itself.) When you wrote XFS data over the ext4fs data, you lost data. Irretrievably. Fortunately, you didn't lose all the data on the disk, but you won't recover everything in one easy step. Your best bet is to recover your data from your backups. If you don't have backups, your options drop off rapidly. Your best bet for data recovery may be to use a professional data recovery service, but that will be quite pricey. After that, using [url=http://www.cgsecurity.org/wiki/PhotoRec]PhotoRec[/url] will probably enable you to recover many of your files, but the last time I checked, PhotoRec didn't do a good job of recovering filenames, so you'll end up spending a lot of time sorting through the files to identify, rename, and organize them.
srs5694
Level 6
Level 6
Posts: 1386
Joined: Mon Feb 27, 2012 1:42 pm

Re: Urgent help needed for partition recovery.

Post by srs5694 »

susanyloanen wrote:
srs5694 wrote:When you wrote XFS data over the ext4fs data, you lost data. Irretrievably. Fortunately, you didn't lose all the data on the disk, but you won't recover everything in one easy step.
TestDisk is powerful free data recovery software! It was primarily designed to help recover lost partitions and/or make non-booting disks bootable again when these symptoms are caused by faulty software, certain types of viruses or human error (such as accidentally deleting a Partition Table). Partition table recovery using TestDisk is really easy.
TestDisk is indeed useful software, but not in this case. For purposes of this discussion, disks are organized using two data structures:
  • Partition tables split the disk into partitions, each partition being a contiguous section of the disk, such as sectors 2048 to 41,943,040.
  • Filesystems reside inside partitions. They're much more complex data structures than partition tables, and they facilitate the naming and organization of individual files.
The original problem described here affects filesystems -- an ext4 filesystem was converted to XFS, which overwrote critical ext4fs data structures. The partition in which this occurred was presumably unaffected.

TestDisk searches for intact filesystem data structures and uses them to determine the size of the filesystem, and thus to create a new/recovered entry in the partition table to describe the filesystem. Because the original problem of this thread involves the accidental conversion of ext4fs to XFS, but without changing the partition table entry, TestDisk would do nothing -- the ext4fs data is either wiped out or corresponds to a partition that already exists but that the OS interprets as XFS. The only way to recover data is, as I wrote earlier, to use a tool like PhotoRec, which looks for evidence of individual files and tries to recover them. This might pluck out many (conceivably even all) of the original files, but probably without some details like filenames.
Locked

Return to “Beginner Questions”