Lost partition after partition resize

How to use TestDisk to recover lost partition
Forum rules
When asking for technical support:
- Search for posts on the same topic before posting a new question.
- Give clear, specific information in the title of your post.
- Include as many details as you can, MOST POSTS WILL GET ONLY ONE OR TWO ANSWERS.
- Post a follow up with a "Thank you" or "This worked!"
- When you learn something, use that knowledge to HELP ANOTHER USER LATER.
Before posting, please read https://www.cgsecurity.org/testdisk.pdf
Locked
Message
Author
scramblerdoodle
Posts: 4
Joined: 03 Apr 2022, 00:10
Location: Paris, France

Lost partition after partition resize

#1 Post by scramblerdoodle »

Hi, everyone.

I have a dual-boot with Ubuntu 20.04 / Windows 10 on a 256 GB SSD.
Yesterday I had to resize their respective partitions (previously being about 150GB to Windows 10, and 50 GB to Ubuntu -- in hindsight, a very silly partition given how much I use Ubuntu, but that's besides the point) to a new size of about 100 GB each (details below).

The resizing for the Windows part ran without issue using Windows' own Disk Management software. The problem happened when I booted up a LiveUSB with Ubuntu to run GParted. I'm also assuming that the LiveUSB installation was corrupted, as I lost all GUI and began having some PCIexpress error messages pop up (not the first time that had happened with this LiveUSB). Either way, I ended up restarting my computer, so the resize was forcefully stopped.

I then re-installed Ubuntu on the LiveUSB, alongside TestDisk, and here's the log from TestDisk's Deeper Search:

Code: Select all

Results
     MS Data                     2048    1050623    1048576 [NO NAME]
     FAT32, blocksize=4096, 536 MB / 512 MiB
     MS Data                     2054    1050629    1048576 [NO NAME]
     FAT32, blocksize=4096, 536 MB / 512 MiB
     MS Data                    32768  291868671  291835904 [SSD]
     NTFS, blocksize=4096, 149 GB / 139 GiB
     MS Data                    32768  402460664  402427897 [SSD]
     NTFS found using backup sector, blocksize=4096, 206 GB / 191 GiB
     MS Data                    32775  402460671  402427897
     NTFS found using backup sector, blocksize=4096, 206 GB / 191 GiB
     MS Data                  1266139    1272312       6174
     NTFS found using backup sector, blocksize=512, 3161 KB / 3087 KiB
     MS Data                  1272312    1278485       6174 [Boot]
     NTFS, blocksize=512, 3161 KB / 3087 KiB
     MS Data                  1272331    1278504       6174
     NTFS found using backup sector, blocksize=512, 3161 KB / 3087 KiB
     MS Data                  1278504    1284677       6174 [Boot]
     NTFS, blocksize=512, 3161 KB / 3087 KiB
     MS Data                  1278523    1284696       6174
     NTFS found using backup sector, blocksize=512, 3161 KB / 3087 KiB
     MS Data                  1284696    1290869       6174 [Boot]
     NTFS, blocksize=512, 3161 KB / 3087 KiB
     MS Data                  1284715    1290888       6174
     NTFS found using backup sector, blocksize=512, 3161 KB / 3087 KiB
     MS Data                  1290888    1297061       6174 [Boot]
     NTFS, blocksize=512, 3161 KB / 3087 KiB
     MS Data                  3003419    3009592       6174
     NTFS found using backup sector, blocksize=512, 3161 KB / 3087 KiB
     MS Data                  3009592    3015765       6174 [Boot]
     NTFS, blocksize=512, 3161 KB / 3087 KiB
     EFI System              48507712   48510591       2880 [EFI System Partition] [EFISECTOR]
     FAT12, blocksize=512, 1474 KB / 1440 KiB
     EFI System              59506240   59509119       2880 [EFI System Partition] [EFISECTOR]
     FAT12, blocksize=512, 1474 KB / 1440 KiB
     EFI System              60771232   60774111       2880 [EFI System Partition] [EFISECTOR]
     FAT12, blocksize=512, 1474 KB / 1440 KiB
     EFI System              61150648   61153527       2880 [EFI System Partition] [EFISECTOR]
     FAT12, blocksize=512, 1474 KB / 1440 KiB
     EFI System              63012280   63015159       2880 [EFI System Partition] [EFISECTOR]
     FAT12, blocksize=512, 1474 KB / 1440 KiB
     EFI System              63828032   63830911       2880 [EFI System Partition] [EFISECTOR]
     FAT12, blocksize=512, 1474 KB / 1440 KiB
     Linux filesys. data     64561009   65932992    1371984 [GW<B9><A4>ث݊<BD><CD>(b<9E>dS<DC>]
     cramfs, 702 MB / 669 MiB
     Linux filesys. data     64561010   65932993    1371984 [GW<B9><A4>ث݊<BD><CD>(b<9E>dS<DC>]
     cramfs, 702 MB / 669 MiB
     Mac HFS                287598822  421816551  134217730
     HFS found using backup sector!, 68 GB / 64 GiB
     Linux filesys. data    291868670  500116917  208248248
     ext4 blocksize=4096 Large_file Sparse_SB Backup_SB, 106 GB / 99 GiB
     Linux filesys. data    291868672  500116919  208248248
     ext4 blocksize=4096 Large_file Sparse_SB, 106 GB / 99 GiB
     Linux Swap             292147192  292147207         16
     SWAP2 version 0, pagesize=8192, 8192 B
     Linux Swap             292147200  296341487    4194288
     SWAP2 version 1, pagesize=4096, 2147 MB / 2047 MiB
     Linux filesys. data    402460670  500116917   97656248
     ext4 blocksize=4096 Large_file Sparse_SB Backup_SB, 49 GB / 46 GiB
     Linux filesys. data    402460672  500116919   97656248
     ext4 blocksize=4096 Large_file Sparse_SB, 49 GB / 46 GiB
     Linux Swap             402739192  402739207         16
     SWAP2 version 0, pagesize=8192, 8192 B
     Linux Swap             402739200  406933487    4194288
     SWAP2 version 1, pagesize=4096, 2147 MB / 2047 MiB
     MS Data                461564603  461567482       2880 [NO NAME]
     FAT12, blocksize=512, 1474 KB / 1440 KiB
     MS Data                461564627  461567506       2880 [NO NAME]
     FAT12, blocksize=512, 1474 KB / 1440 KiB
     MS Data                461565483  461568362       2880 [NO NAME]
     FAT12, blocksize=512, 1474 KB / 1440 KiB
I had a lot more info on my original post, such as the specific sectors allocated to each section according to parted, as well as some personal findings (I'm able to see which partitions found by TestDisk correspond to my old ones, which correspond to my new ones, etc).

My biggest question is: is it worth it trying to restore the old partitions in order to try and properly resize the partition? Or should I cut my losses and get a fresh Ubuntu install, given as I did save a backup before doing all of this?

I also had a few more questions, mostly to learn more, but they also have been lost to time. I do remember one of them, though: the MSR partition does not seem to be found by TestDisk. Should I add it manually (again, a priori I know exactly which sectors belong to it) or is that generally a bad idea?

P.S.: smartmontools shows no problems with the SDD, as evidenced by:

Code: Select all

smartctl 7.1 2019-12-30 r5022 [x86_64-linux-5.13.0-30-generic] (local build)
Copyright (C) 2002-19, Bruce Allen, Christian Franke, www.smartmontools.org

=== START OF INFORMATION SECTION ===
Device Model:     LITEON CV3-8D256-HP
Serial Number:    0018152000CD
LU WWN Device Id: 5 002303 1011a1c09
Firmware Version: V381
User Capacity:    256,060,514,304 bytes [256 GB]
Sector Sizes:     512 bytes logical, 4096 bytes physical
Rotation Rate:    Solid State Device
Form Factor:      M.2
Device is:        Not in smartctl database [for details use: -P showall]
ATA Version is:   ACS-4, ATA/ATAPI-7 T13/1532D revision 4a
SATA Version is:  SATA 3.2, 6.0 Gb/s (current: 6.0 Gb/s)
Local Time is:    Sun Apr  3 07:51:22 2022 UTC
SMART support is: Available - device has SMART capability.
SMART support is: Enabled

=== START OF READ SMART DATA SECTION ===
SMART overall-health self-assessment test result: PASSED

General SMART Values:
Offline data collection status:  (0x02)	Offline data collection activity
					was completed without error.
					Auto Offline Data Collection: Disabled.
Self-test execution status:      (   0)	The previous self-test routine completed
					without error or no self-test has ever 
					been run.
Total time to complete Offline 
data collection: 		(   10) seconds.
Offline data collection
capabilities: 			 (0x5b) SMART execute Offline immediate.
					Auto Offline data collection on/off support.
					Suspend Offline collection upon new
					command.
					Offline surface scan supported.
					Self-test supported.
					No Conveyance Self-test supported.
					Selective Self-test supported.
SMART capabilities:            (0x0003)	Saves SMART data before entering
					power-saving mode.
					Supports SMART auto save timer.
Error logging capability:        (0x01)	Error logging supported.
					General Purpose Logging supported.
Short self-test routine 
recommended polling time: 	 (   2) minutes.
Extended self-test routine
recommended polling time: 	 (  10) minutes.
SCT capabilities: 	       (0x003d)	SCT Status supported.
					SCT Error Recovery Control supported.
					SCT Feature Control supported.
					SCT Data Table supported.

SMART Attributes Data Structure revision number: 1
Vendor Specific SMART Attributes with Thresholds:
ID# ATTRIBUTE_NAME          FLAG     VALUE WORST THRESH TYPE      UPDATED  WHEN_FAILED RAW_VALUE
  1 Raw_Read_Error_Rate     0x002f   100   100   050    Pre-fail  Always       -       0
  5 Reallocated_Sector_Ct   0x0033   100   100   005    Pre-fail  Always       -       0
  9 Power_On_Hours          0x0032   100   100   000    Old_age   Always       -       1502
 12 Power_Cycle_Count       0x0032   100   100   000    Old_age   Always       -       1639
171 Unknown_Attribute       0x0032   100   100   000    Old_age   Always       -       0
172 Unknown_Attribute       0x0032   100   100   000    Old_age   Always       -       0
173 Unknown_Attribute       0x0032   099   099   005    Old_age   Always       -       33
174 Unknown_Attribute       0x0032   100   100   000    Old_age   Always       -       81
176 Erase_Fail_Count_Chip   0x0022   100   100   000    Old_age   Always       -       0
181 Program_Fail_Cnt_Total  0x0022   100   100   000    Old_age   Always       -       0
183 Runtime_Bad_Block       0x0032   100   100   000    Old_age   Always       -       0
184 End-to-End_Error        0x003b   100   100   097    Pre-fail  Always       -       0
187 Reported_Uncorrect      0x0032   100   100   000    Old_age   Always       -       0
188 Command_Timeout         0x0032   100   100   000    Old_age   Always       -       0
194 Temperature_Celsius     0x0022   100   100   000    Old_age   Always       -       64 (Min/Max 28/65)
198 Offline_Uncorrectable   0x0030   100   100   000    Old_age   Offline      -       0
199 UDMA_CRC_Error_Count    0x0032   100   100   000    Old_age   Always       -       0
241 Total_LBAs_Written      0x0032   100   100   000    Old_age   Always       -       361702
242 Total_LBAs_Read         0x0032   100   100   000    Old_age   Always       -       532968
243 Unknown_Attribute       0x0032   100   100   000    Old_age   Always       -       528832

SMART Error Log Version: 0
No Errors Logged

SMART Self-test log structure revision number 1
Num  Test_Description    Status                  Remaining  LifeTime(hours)  LBA_of_first_error
# 1  Short offline       Completed without error       00%         3         -

SMART Selective self-test log data structure revision number 0
Note: revision number not 1 implies that no selective self-test has ever been run
 SPAN  MIN_LBA  MAX_LBA  CURRENT_TEST_STATUS
    1        0        0  Not_testing
    2        0        0  Completed [00% left] (0-65535)
    3        0        0  Not_testing
    4        0        0  Not_testing
    5        0        0  Not_testing
Selective self-test flags (0x0):
  After scanning selected spans, do NOT read-scan remainder of disk.
If Selective self-test is pending on power-up, resume after 0 minute delay.
recuperation
Posts: 3029
Joined: 04 Jan 2019, 09:48
Location: Hannover, Deutschland (Germany, Allemagne)

Re: Lost partition after partition resize

#2 Post by recuperation »

After the failure of the Live USB you started your Windows installation successfully. What about the linux installation?
You are now talking about a SSD whereas you mentioned a hybrid SSD in the posting I disapproved. The one in the smartmontools log file is just a M.2 SSD and not a hybrid one.

Please explain!
scramblerdoodle
Posts: 4
Joined: 03 Apr 2022, 00:10
Location: Paris, France

Re: Lost partition after partition resize

#3 Post by scramblerdoodle »

The Windows partition was resized with no issue whatsoever. If I override the boot I can easily access it.

The Linux installation got completely destroyed -- no boot, only a couple of the files that were on the old partition got copied to the new resized one.

Maybe there was a misunderstanding at some point, but I currently have two disks on my computer: sda being an HDD that I use mostly to keep files, that's working as intended, whereas sdb is the M.2 SDD where I keep the operating systems. I mentioned the HDD to ask if I would be able to copy the files from the old partition onto this other HDD.
recuperation
Posts: 3029
Joined: 04 Jan 2019, 09:48
Location: Hannover, Deutschland (Germany, Allemagne)

Re: Lost partition after partition resize

#4 Post by recuperation »

I would simply reinstall linux.
As for the Microsoft reserved partition, Testdisk will show it if its exists.
As your Windows runs fine even without its existence there is no need to fool around with the disk.
scramblerdoodle
Posts: 4
Joined: 03 Apr 2022, 00:10
Location: Paris, France

Re: Lost partition after partition resize

#5 Post by scramblerdoodle »

Yeah, that's what I was just thinking. Given that the rest of the disk seems to work fine, I was afraid of messing around with it and destroying Windows' installation as well.

Luckily I ran a personal backup before all of this and, even if I hadn't, thanks to the tool I would've been able to recover my files.
This was mostly a learning endeavor rather than a necessity, as I was hoping to understand exactly what was going on with my SSD, but I suppose I can let it go since overall it's working fine.

Alright, that's good enough for me.
Cheers, and thanks for the attention!
recuperation
Posts: 3029
Joined: 04 Jan 2019, 09:48
Location: Hannover, Deutschland (Germany, Allemagne)

Re: Lost partition after partition resize

#6 Post by recuperation »

I forgot to say:

Always completely shut down your operating system in a dual-boot environment.
Locked