Switch to full style
Data recovery and disk repair questions and discussions related to old-fashioned SATA, SAS, SCSI, IDE, MFM hard drives - any type of storage device that has moving parts
Post a reply

utility to rebuild ext4 partition?

December 1st, 2022, 13:19

Totally my own fault as I pressed too many buttons without a backup, but am hoping that all is not lost.

I have a 1TB Sata Disk in my Linux Laptop. I had a problem with the Grub file and tried to rebuild it but without any luck. This morning, I could reboot the laptop system by first booting from a USB drive, then using Grub utilities to boot the laptop, I should have made a backup at that point but... I tried to rebuild the Grub file and it looks like somehow the partition table and maybe some of the root partition were overwritten. Not surprisingly the system will no longer boot.
I've booted another system and attached the 1Tb drive via USB, I can scan the 1TB drive using Testdisk which can see the partition data and the directories under root but all of the sub directories such as home are empty with no chance of copying any data. I've run Foremost against a partial dd copy of the drive and it finds files, as does Photorec which is running now.

I'm wondering if anyone on here knows a way to rebuild the directories in the partition?

Thanks.

Re: utility to rebuild ext4 partition?

December 1st, 2022, 13:56

You can't 'rebuild' with ext4, you are beyond that now. Best you can hope for is to recover the data and start afresh. You made a good choice by making an image of the drive (not sure why you would only want to make a partial image). If you want to start imaging again use HDDSuperclone. But use a decent data recovery software such as DMDE, R-Studio or UFS Explorer. and DO NOT save any data back to the drive you are recovering from.

Re: utility to rebuild ext4 partition?

December 2nd, 2022, 5:35

Thanks for the advice, I'll look into the packages you've suggested.
The reason I made a partial image is that I don't have a large enough drive to take the whole partition from the SSD so decided it was best to experiment on a test area.

Re: utility to rebuild ext4 partition?

December 2nd, 2022, 6:29

I forgot to add (too late to edit my post above) that I do actually have a large enough disk to make a full copy but it has backup data on it. I'll copy the backups to a smaller drive then use the backup drive for making an image of the problem drive. When I rebuild the main 1TB drive I'll make some smaller partitions next time!

Re: utility to rebuild ext4 partition?

December 2nd, 2022, 12:13

cancunia wrote:The reason I made a partial image is that I don't have a large enough drive to take the whole partition from the SSD.

Unfortunately SSDs do not work in the same way as HDDs. They have a nasty habit of permanently deleting data. However making an image is the best idea. Good luck.

Re: utility to rebuild ext4 partition?

December 11th, 2022, 9:49

ddrecovery wrote:Unfortunately SSDs do not work in the same way as HDDs. They have a nasty habit of permanently deleting data. However making an image is the best idea. Good luck.


Thanks for your help, I used a mix of tools and got a lot of data back.
TestDisk / PhotoRec
Foremost
R-Linux (R-Studio)

Testdisk allowed me to restore the partitions
Photorec recovered a lot of files, along with the Python program (sort-PhotorecRecoveredFiles
) to sort the files.
Foremost recovered some files but not as many as Photorec
R-Linux was overall, the most useful tool as it recovered files with their original names and directories.

Re: utility to rebuild ext4 partition?

December 12th, 2022, 13:18

Testdisk allowed me to restore the partitions


Assuming you did on original drive: next time skip this step, a tool like R-Linux will detect the file systems whether partition table is present/intact or not. Arguably rebuilding partition table is low risk step, but if it can be avoided you should IMO.

Re: utility to rebuild ext4 partition?

December 12th, 2022, 13:35

Arch Stanton wrote:
Testdisk allowed me to restore the partitions


Assuming you did on original drive: next time skip this step, a tool like R-Linux will detect the file systems whether partition table is present/intact or not. Arguably rebuilding partition table is low risk step, but if it can be avoided you should IMO.


Yes, I've learned a lot from this experience. I started with TestDisk & wanted the partitions as I thought at first that the files might just be there ready to be copied off, and when I had the partitions restored, it was better to make an image of the partition rather than an image of the whole 1TB drive. Hopefully there will not be a next time, but if there is, I'll start with R-Linux!

Thanks again for the help.
Post a reply