partitioning/formatting oops.

Dear Opensuse Experts:

I am searching around on the Forums -
I was installing Leap42.2 over my 13.2 install - which was a dual-boot configuration with win7 - but accidentally declared an Ext4 data partition (sda3) as the GRUB2 EFI boot partition, which was formatted to FAT32. I am currently dd’ing that device for file recovery (using TestDisk) and was wondering if anyone has any better ideas for linux (i.e., Ext4-aware) file recovery. I’m mostly interested in a couple of VirtualBox drives (i.e., big files) that were on the old Ext4 partition. I think FAT32/boot is benign to the disk, so they should be recoverable, but a Wind*ws file-recovery program wasn’t much help (I think because W doesn’t play nicely with Ext4).

Thank You Very Much In Advance,
Patricia

Oopsie :open_mouth:

That FAT partition is the EFI boot. It is required to be FAT by the UEFI (read BIOS). It is a crapshoot if it can be recovered it will probably have to be redone. It will probably require a Windows repair disk to fix the Windows directory and you should be able to repair the openSUSE directories with a reinstall selecting upgrade. (do not reformat that partition it should only be mounted as /boot/efi)

Hi Golgathorp - thank you very much for the reply. I’ve been running PhotoRec and TestDisk on that partition and they recover a lot of files, but not the big VirtualBox .vdi drives I had (PhotoRec doesn’t seem to recognize that sort of file). PhotoRec found several 10’s of thousands of files, many of which I could tell were more or less correct. It seemed to find different files depending on whether I told it that the formatted partition FAT or Ext4. Don’t know why, or what’s appropriate (it was Ext before FAT)

History: HP i7 laptop (single drive, 1TB Samsung 850Pro SSD) that started life as a Win7 machine. So the first few partitions were stock Win7. I shrank Win7 and installed 13.1 swap/root/home/data. When I finally gave up on win, I reformatted the main windows drive as Ext4 and used it as a data drive (sda3 / other partitions left intact). This worked fine until the other day when I installed Leap 42.2 and, somehow got sda3 set as the EFI drive (13.2 was using MBR-installed GRUB). So now sda3 is a ~380GB FAT EFI drive, but most of the data is still there. EFI is tiny, so basically all the data should be there, but I don’t know the smartest way to go after it.


**#>fdisk -l
**
Disk /dev/sda: 953.9 GiB, 1024209543168 bytes, 2000409264 sectors                                                  
Units: sectors of 1 * 512 = 512 bytes                                                                              
Sector size (logical/physical): 512 bytes / 512 bytes                                                              
I/O size (minimum/optimal): 512 bytes / 512 bytes                                                                  
Disklabel type: gpt                                                                                                
Disk identifier: 2D0FF7AA-208C-4734-A23C-1D9983FBBC0C                                                              
                                                                                                                   
Device          Start        End   Sectors   Size Type                                                             
/dev/sda2      821248    1353727    532480   260M BIOS boot                                                        
/dev/sda3     1353728  812263423 810909696 386.7G EFI System                                                       
/dev/sda6   812288000  845055999  32768000  15.6G Microsoft basic data                                             
/dev/sda7   845056000 1013401599 168345600  80.3G EFI System                                                       
/dev/sda8  1013401600 2000408575 987006976 470.7G Microsoft basic data                                             

**#> sudo parted -l
**Model: ATA Samsung SSD 850 (scsi)
Disk /dev/sda: 1024GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags: pmbr_boot

Number  Start  End     Size    File system     Name                  Flags
 2      420MB  693MB   273MB                   EFI system partition  bios_grub
 3      693MB  416GB   415GB   fat32           primary               boot, legacy_boot
 6      416GB  433GB   16.8GB  linux-swap(v1)  primary
 7      433GB  519GB   86.2GB  btrfs           primary               boot
 8      519GB  1024GB  505GB   ext4            primary

Model: ASMT 2115 (scsi)
Disk /dev/sdb: 1000GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags: 

**#> lsblk
**NAME   MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sda      8:0    0 953.9G  0 disk 
├─sda2   8:2    0   260M  0 part 
├─sda3   8:3    0 386.7G  0 part 
├─sda6   8:6    0  15.6G  0 part [SWAP]
├─sda7   8:7    0  80.3G  0 part /var/lib/mariadb
└─sda8   8:8    0 470.7G  0 part /home
sr0     11:0    1  1024M  0 rom  

**#> sudo hwinfo --block --short
**root's password:
disk:                                                           
  /dev/sda             Samsung SSD 850
partition:
  /dev/sda2            Partition
  /dev/sda3            Partition
  /dev/sda6            Partition
  /dev/sda7            Partition
  /dev/sda8            Partition
cdrom:
  /dev/sr0             hp CDDVDW SU-208FB

I would love to hear possible solutions.
I made an “image” of the partition with gnu_ddrescue, but plan to leave sda3 alone until I can figure something out (it’s not mounted).
After recovering data, my thought is to reinstall 42.2 (after shrinking and moving sda3 with gparted) to make room for a tiny EFI partition and recover that disk space.

Thank You,
PattiM

One last question - can I reinstall 42.2 and set sda2 to be the EFI/boot? I believe sda2 is left over from the booting of OS13.2 and is not currently used by 42.2 on my system. (This would allow me to work on sda3 for file recovery after accidental fat32 formatting.)


Device          Start        End   Sectors   Size Type
/dev/sda2      821248    1353727    532480   260M BIOS boot
/dev/sda3     1353728  812263423 810909696 386.7G EFI System
/dev/sda6   812288000  845055999  32768000  15.6G Microsoft basic data
/dev/sda7   845056000 1013401599 168345600  80.3G EFI System
/dev/sda8  1013401600 2000408575 987006976 470.7G Microsoft basic data 

Number  Start  End     Size    File system     Name                  Flags
 2      420MB  693MB   273MB                   EFI system partition  bios_grub
 3      693MB  416GB   415GB   fat32           primary               boot, legacy_boot
 6      416GB  433GB   16.8GB  linux-swap(v1)  primary
 7      433GB  519GB   86.2GB  btrfs           primary               boot
 8      519GB  1024GB  505GB   ext4            primary

Yes… Maybe clean up any directories left by 13.1 so absolutely no confusion. Also while there and since you dumped Windows remove and Windows directories. As a rule thy don’t get cleaned up. Also after install run efibootmgr and clean up the UEFI flash boot tables. Also if in doubt show us before removing any.