LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Help deleting old partitions (https://www.linuxquestions.org/questions/linux-newbie-8/help-deleting-old-partitions-4175647189/)

zavmat 01-29-2019 12:00 AM

Help deleting old partitions
 
I have a partition using up 200gb for an outdated kernal. I'm trying to delete it with fdisk but I'm having some trouble. As the thread suggests I'm a total noob to linux. My disk is partitioned into at least five other useless sections and I'm trying to make it all sane again.

Don't get me wrong, I've been enjoying all the craziness, it makes me appreciate my laptop a lot more than I used to. When I was younger I messed around with installing open source bios' on old 3rd party mp3 players that my Dad tortured my sister with (First world problems am I right?). That experience opened my eyes to alternatives to big name brands like Apple and Microsoft that operate with business models that encourages users NOT to learn.

But enough of my life story, let's take a look at the data shall we?

Code:

[madmin@localhost ~]$ sudo fdisk /dev/sda

Welcome to fdisk (util-linux 2.32.1).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.


Command (m for help): d
Partition number (1-14, default 14): 9

Partition 9 has been deleted.

Command (m for help): sudo fdisk -l
Created a new partition 1 of type 'Linux native' and of size 698.6 GiB.
Created a new partition 2 of type 'Linux swap' and of size 47.1 MiB.
Created a new partition 3 of type 'Whole disk' and of size 698.7 GiB.
Created a new Sun disklabel.
The old gpt signature will be removed by a write command.

Command (m for help):


Command (m for help): m

Help:

  Sun
  a  toggle the read-only flag
  c  toggle the mountable flag

  Generic
  d  delete a partition
  F  list free unpartitioned space
  l  list known partition types
  n  add a new partition
  p  print the partition table
  t  change a partition type
  v  verify the partition table
  i  print information about a partition

  Misc
  m  print this menu
  u  change display/entry units
  x  extra functionality (experts only)

  Script
  I  load disk layout from sfdisk script file
  O  dump disk layout to sfdisk script file

  Save & Exit
  w  write table to disk and exit
  q  quit without saving changes

  Create a new label
  g  create a new empty GPT partition table
  G  create a new empty SGI (IRIX) partition table
  o  create a new empty DOS partition table
  s  create a new empty Sun partition table


Command (m for help): w

The partition table has been altered.
Failed to remove partition 1 from system: Device or resource busy
Failed to remove partition 12 from system: Device or resource busy
Failed to remove partition 13 from system: Device or resource busy
Failed to remove partition 14 from system: Device or resource busy
Failed to add partition 1 to system: Device or resource busy
Failed to add partition 3 to system: Device or resource busy

The kernel still uses the old partitions. The new table will be used at the next reboot.
Syncing disks.


Brains 01-29-2019 12:10 AM

Quote:

The old gpt signature will be removed by a write command
You need to use Gdisk with GPT drives, not fdisk

mrmazda 01-29-2019 03:26 AM

not fdisk - check
need gdisk - nope
need any partitioning tool that supports gpt - yes, e.g.
PHP Code:

cfdisk
cgdisk
dfsee
gparted
parted
ranish
sfdisk
sgdisk 

and more. Some are available for multiple operating systems using the same interface.

Distro installers commonly incorporate some variation of parted, which is also the basis of gparted, which operates from its own bootable media.

fatmac 01-29-2019 04:57 AM

Just curious, why a sun disklabel(?), if you're having Linux partitions.

Quote:

Created a new Sun disklabel.
The old gpt signature will be removed by a write command.

rknichols 01-29-2019 09:39 AM

Quote:

Originally Posted by zavmat (Post 5954807)
Code:

[madmin@localhost ~]$ sudo fdisk /dev/sda

Welcome to fdisk (util-linux 2.32.1).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.


Command (m for help): d
Partition number (1-14, default 14): 9

Partition 9 has been deleted.

Command (m for help): sudo fdisk -l
Created a new partition 1 of type 'Linux native' and of size 698.6 GiB.
Created a new partition 2 of type 'Linux swap' and of size 47.1 MiB.
Created a new partition 3 of type 'Whole disk' and of size 698.7 GiB.
Created a new Sun disklabel.
The old gpt signature will be removed by a write command.


NO, NO, NO!!
When you entered that command shown in red you were already within the fdisk utility, and it interpreted that whole string as some sequence of internal commands. You have now thoroughly scrambled your partition table and have written that scrambled table to the disk. The only reason your system is still running is because the kernel is still using the old table. You will not be able to reboot.

Before doing anything else, run
Code:

cat /proc/partitions
cat /sys/block/sda/sda*/start

and post the result. That will provide information to help in reconstructing the old partitioning.

Reference: https://unix.stackexchange.com/quest...ble-of-dev-sda

dc.901 01-29-2019 11:17 AM

In addition to what rknichols has (in #5), you are trying this on /dev/sda, which is usually what the OS is booted of (this is true a lot of times but perhaps not always).
Are the partitions you are trying to remove on same disk drive OS is running from, or do you have another hard drive in your computer that you are trying to do this on?

zavmat 01-29-2019 01:09 PM

you're right I cannot reboot... i'm sitting at the grub command menu from my live usb as we speak. Keep in mind this is an experimental machine. Is my windows os still safe? I don't have any reclaimable space to install another fedora kernal

rknichols 01-29-2019 01:40 PM

What distribution is on that live USB? What you need now is a bootable medium that includes the testdisk utility, which is the tool of choice for recovering lost partitions.

@dc.901: This is a laptop, which almost certainly has only one disk.

zavmat 01-29-2019 01:43 PM

Fedora 29, I'm booted to the live disk right now

rknichols 01-29-2019 02:04 PM

Quote:

Originally Posted by zavmat (Post 5955093)
Fedora 29, I'm booted to the live disk right now

I just downloaded and booted Fedora 29 Workstation Live, and it does not appear to include testdisk, but that package is available and can be installed. Go ahead and boot that USB drive and select "Try Fedora" from the menu. bring up a terminal and run "su -" to get a root shell (no password needed on the live ISO). From there, once networking is available, you can run "dnf install testdisk".

Further instructions coming once you've done that.

zavmat 01-29-2019 02:17 PM

Error

Code:

[liveuser@localhost ~]$ su -
[root@localhost-live ~]# dnf install testdisk
Fedora Modular 29 - x86_64                      267 kB/s | 1.5 MB    00:05   
Fedora Modular 29 - x86_64 - Updates            2.6 kB/s | 3.4 kB    00:01   
Error: Failed to synchronize cache for repo 'updates-modular'
[root@localhost-live ~]#


rknichols 01-29-2019 02:33 PM

Do you have networking? What is the result from "ping -c1 mirrors.fedoraproject.org" ?

zavmat 01-29-2019 02:54 PM

[root@localhost-live ~]# ping -cl mirrors.fedoraproject.org
ping: bad number of packets to transmit.

rknichols 01-29-2019 02:57 PM

Quote:

Originally Posted by zavmat (Post 5955131)
[root@localhost-live ~]# ping -cl mirrors.fedoraproject.org
ping: bad number of packets to transmit.

That's a digit "1".

zavmat 01-29-2019 03:00 PM

oops my mistate

Code:

[root@localhost-live ~]# ping c1 mirrors.fedoraproject.org
PING  (104.239.198.84) 56(124) bytes of data.

It's connected to the network

Code:

[root@localhost-live ~]# ping c1 mirrors.fedoraproject.org
PING  (104.239.198.84) 56(124) bytes of data.
^C
---  ping statistics ---
420 packets transmitted, 0 received, 100% packet loss, time 461ms

That would suggest it isn't able to reach the download source though, but I'm typing this from the laptop in question

Edit: it's downloading now.

mrmazda 01-29-2019 03:13 PM

Quote:

Originally Posted by zavmat (Post 5955115)
Error: Failed to synchronize cache for repo 'updates-modular'

Assuming you get network up, if simply waiting to try again fails, then try the following:
Code:

dnf clean all
dnf update
dnf install testdisk


rknichols 01-29-2019 03:15 PM

And presumably there was some response to that ping, right?

I don't know what your issue might be. I had just downloaded and booted Fedora-Workstation-Live-x86_64-29-1.2.iso in a virtual machine, and that "dnf install testdisk" command worked just fine.

Sorry, I was entering my reply before you discovered that networking was, in fact, not up.

If that's not going to work, then I suggest that you download SystemRescueCd and put it on a CD or USB flash drive. That toolkit does include testdisk. Note: Putting SystemRescueCd on a USB flash drive is not as simple as it should be. The instructions are here.

zavmat 01-29-2019 03:42 PM

alright test disk is officially installed! Sorry to take you down a winding road there...

rknichols 01-29-2019 03:54 PM

OK, so from the root prompt run "testdisk /dev/sda" . It should come up with disk /dev/sda selected. Select (with the arrow keys) "Proceed" and press <Enter>.

On the next screen select "EFI GPT partition map" and press <Enter>.

On the next screen select "Analyze" and press <Enter>.

On the next screen you will see messages that the main and alternate GPT are invalid. No surprise -- you wiped them out. Run "Quick Search" and see if the partitions detected look like what you had before. Post the result if you want to.

zavmat 01-29-2019 04:04 PM

looks pretty good to me, I'm just glad windows didn't get wiped...

Code:

TestDisk 7.0, Data Recovery Utility, April 2015
Christophe GRENIER <grenier@cgsecurity.org>
http://www.cgsecurity.org

Disk /dev/sda - 750 GB / 698 GiB - CHS 91201 255 63
    Partition              Start        End    Size in sectors
>P MS Data                    2048    411647    409600 [SYSTEM]
 D MS Data                  673792  552939512  552265721
 D MS Data                  673799  552939519  552265721
 D MS Data                552939519 1105205239  552265721
 D MS Data              1094012926 1400688637  306675712
 D MS Data              1360289793 1412718592  52428800
 D Linux Swap            1400688640 1412714479  12025840
 D MS Data              1412718592 1465147391  52428800




Structure: Ok.  Use Up/Down Arrow keys to select partition.
Use Left/Right Arrow keys to CHANGE partition characteristics:
                P=Primary  D=Deleted
Keys A: add partition, L: load backup, T: change type, P: list files,
    Enter: to continue
FAT32, blocksize=2048, 209 MB / 200 MiB


rknichols 01-29-2019 04:17 PM

I see that the 2nd and 3rd entries overlap, so they can't both be correct. That 3rd entry overlaps the 4th by 1 sector, so what I would do is change the characteristic to "P" for all entries except the 3rd one, then press <Enter> to continue. If, on the next screen, testdisk doesn't find anything to complain about, select "Write" and press <Enter>. (It might help to grit your teeth, hold your nose, cover your ears, and cross your fingers when doing that.)

The system might still not boot because of incorrect partition types. We can work on that next.

zavmat 01-29-2019 04:30 PM

alright I'm getting a few "structure bad" responses whenever I change the partitions that are still D here:
Code:

TestDisk 7.0, Data Recovery Utility, April 2015
Christophe GRENIER <grenier@cgsecurity.org>
http://www.cgsecurity.org

Disk /dev/sda - 750 GB / 698 GiB - CHS 91201 255 63
    Partition              Start        End    Size in sectors
 P MS Data                    2048    411647    409600 [SYSTEM]
 P MS Data                  673792  552939512  552265721
 D MS Data                  673799  552939519  552265721
 P MS Data                552939519 1105205239  552265721
 D MS Data              1094012926 1400688637  306675712
 P MS Data              1360289793 1412718592  52428800
 D Linux Swap            1400688640 1412714479  12025840
>D MS Data              1412718592 1465147391  52428800




Structure: Ok.  Use Up/Down Arrow keys to select partition.
Use Left/Right Arrow keys to CHANGE partition characteristics:
                P=Primary  D=Deleted
Keys A: add partition, L: load backup, T: change type, P: list files,
    Enter: to continue
NTFS, blocksize=4096, 26 GB / 25 GiB


rknichols 01-29-2019 04:41 PM

Indeed there are some other overlaps that I hadn't noticed. It looks like this disk has gone through several cycles of partition changes and filesystems, and testdisk is seeing leftover old filesystem headers. I think the only thing to do is leave things as ther are here, proceed to the next screen, and select "Deeper Search". That's going to take quite a lot of time and produce more output, but with luck it will be possible to find a consistent set of partitions that makes sense.

zavmat 01-29-2019 04:50 PM

It's analysing the cylinder as we speak, it's going to take some time like you said.

zavmat 01-29-2019 07:03 PM

Here it is:

Code:

TestDisk 7.0, Data Recovery Utility, April 2015
Christophe GRENIER <grenier@cgsecurity.org>
http://www.cgsecurity.org

Disk /dev/sda - 750 GB / 698 GiB - CHS 91201 255 63

The harddisk (750 GB / 698 GiB) seems too small! (< 16495006 TB / 15002120 TiB)
Check the harddisk size: HD jumpers settings, BIOS detection...

The following partitions can't be recovered:
    Partition              Start        End    Size in sectors
  MS Data              1371546624 5225138636218422 5225137264671798 [multi-dev
  MS Data              1373078136 3258639578 1885561443
  MS Data              1373641178 5225138638312976 5225137264671798 [multi-dev
  MS Data              1413028960 1815450712  402421753
  MS Data              1465147391 1517576190  52428800
  Linux Raid            35378414727820530 32216808923708550 32867191214851989 [
  Linux Raid            35378414733958938 32216808929846958 32867191214851989 [
  Linux Raid            35378414738464218 32216808934352238 32867191214851989 [
  Linux Raid            35378415137389970 32216809333277990 32867191214851989 [
>  Linux Raid            35378415140317858 32216809336205878 32867191214851989 [
~K^UM-"=^E]
[ Continue ]
md 1.x L.Endian Raid 2088978687 - Array Slot : 2285961301 (), 16828001 TB / 1530


rknichols 01-29-2019 09:48 PM

Alas, that doesn't seem to be showing everything. I have to ask you to do it again, this time running "testdisk /log /dev/sda" and then showing the content of the tesstdisk.log file generated, either inline (wrapped in [CODE] ... [/CODE] tags please) or else attached as a text file.

zavmat 01-29-2019 10:13 PM

Now it's showing a ton of partitions, There's gotta be over 100

Code:

TestDisk 7.0, Data Recovery Utility, April 2015
Christophe GRENIER <grenier@cgsecurity.org>
http://www.cgsecurity.org

Disk /dev/sda - 750 GB / 698 GiB - CHS 91201 255 63
    Partition              Start        End    Size in sectors
>D MS Data                    2048    411647    409600 [SYSTEM]
 D MS Data                    2054    411653    409600 [NO NAME]
 D MS Data                    10272    419871    409600 [NO NAME]
 D MS Data                  673792  552939512  552265721
 D MS Data                  673792  584783204  584109413
 D MS Data                  673799  552939519  552265721
 D Mac HFS                  5024992    5067007      42016
 D Mac HFS                  5067004    5109019      42016
 D MS Data                12296425  13668408    1371984 [GWM-9M-$ث݊M-= b~^dS
 D MS Data                12296426  13668409    1371984 [GWM-9M-$ث݊M-= b~^dS
 D MS Data                16369632  328939487  312569856
 D Mac HFS                122777084  122819099      42016
Structure: Ok.  Use Up/Down Arrow keys to select partition.
Use Left/Right Arrow keys to CHANGE partition characteristics:
                P=Primary  D=Deleted
Keys A: add partition, L: load backup, T: change type, P: list files,
    Enter: to continue
FAT32, blocksize=2048, 209 MB / 200 MiB


zavmat 01-30-2019 11:22 AM

Sorry for the confusion, I quit out of testdisk and tried to get to where you want me to but I'm getting this result:

Code:

[root@localhost-live ~]# testdisk /log/dev/sda
TestDisk 7.0, Data Recovery Utility, April 2015
Christophe GRENIER <grenier@cgsecurity.org>
http://www.cgsecurity.org

Unable to open file or device /log/dev/sda: No such file or directory
[root@localhost-live ~]#


rknichols 01-30-2019 11:30 AM

Quote:

Originally Posted by zavmat (Post 5955526)
Sorry for the confusion, I quit out of testdisk and tried to get to where you want me to but I'm getting this result:

Code:

[root@localhost-live ~]# testdisk /log/dev/sda
TestDisk 7.0, Data Recovery Utility, April 2015
Christophe GRENIER <grenier@cgsecurity.org>
http://www.cgsecurity.org

Unable to open file or device /log/dev/sda: No such file or directory
[root@localhost-live ~]#


There should be a space after "/log" .

If the log file is large, consider using https://pastebin.com rather than posting or attaching it here.

zavmat 01-30-2019 12:54 PM

It brought me back to the select partition menu.

Edit: It's analyzing /dev/sda

zavmat 01-30-2019 03:23 PM

1 Attachment(s)
Here's the pastebin text file.
AS you can see there are now a few more MS DATA partitions. What did we do differently this time?

Attachment 29654

rknichols 01-30-2019 07:10 PM

That looks like a pastebin of the screen display, not the testdisk.log file. I need to see the latter.

zavmat 01-30-2019 07:42 PM

I did testdisk /log /dev/sda and it didn't make a log file. [Edit] sorry that wasn't meant to be the whole message I'm confined to my phone while the test disk scans the system again. Do you know how to get to get the testdisk.log file?

jefro 01-30-2019 08:06 PM

Fedora 29 live has a partition program similar to gparted.

Edited out line.

zavmat 01-30-2019 08:32 PM

WFV suggested gparted, I'm unfamiliar with it though. All I have is Linux live right now.

zavmat 01-30-2019 09:09 PM

Still not sure how to make the log file, but I'm sitting at this menu right now showing the partitions that cannot be recovered.

Code:

TestDisk 7.0, Data Recovery Utility, April 2015
Christophe GRENIER <grenier@cgsecurity.org>
http://www.cgsecurity.org

Disk /dev/sda - 750 GB / 698 GiB - CHS 91201 255 63

The harddisk (750 GB / 698 GiB) seems too small! (< 16495006 TB /
Check the harddisk size: HD jumpers settings, BIOS detection...

The following partitions can't be recovered:
    Partition              Start        End    Size in sectors
>  MS Data                721760312 1547747383  825987072
  MS Data              1000128448 1826115519  825987072
  MS Data              1371546624 5225138636218422 5225137264671
  MS Data              1373078136 3258639578 1885561443
  MS Data              1373641178 5225138638312976 5225137264671
  MS Data              1413028960 1815450712  402421753
  MS Data              1465147391 1517576190  52428800
  Linux Raid            35378414727820530 32216808923708550 32867
  Linux Raid            35378414733958938 32216808929846958 32867
  Linux Raid            35378414738464218 32216808934352238 32867
  Linux Raid            35378415137389970 32216809333277990 32867
>  Linux Raid            35378415140317858 32216809336205878 32867
191214851989 [~K^UM-"=^E]
[ Continue ]
md 1.x L.Endian Raid 2088978687 - Array Slot : 2285961301 (), 1682


rknichols 01-30-2019 09:16 PM

Quote:

Originally Posted by zavmat (Post 5955728)
Still not sure how to make the log file,

It should create a log file right there in the directory you were in when you ran "testdisk /log /dev/sda", at least it does when I boot Fedora-Workstation-Live-x86_64-29-1.2.iso and run that testdisk command. When you quit from testdisk and run "ls", it should be right there.

zavmat 01-30-2019 09:19 PM

when I input testdisk /log /dev/sda in the root it yields this:

Code:

TestDisk 7.0, Data Recovery Utility, April 2015
Christophe GRENIER <grenier@cgsecurity.org>
http://www.cgsecurity.org

  TestDisk is free software, and
comes with ABSOLUTELY NO WARRANTY.

Select a media (use Arrow keys, then press Enter):
>Disk /dev/sda - 750 GB / 698 GiB - ST9750420AS









>[Proceed ]  [  Quit  ]

Note: Disk capacity must be correctly detected for a successful re
If a disk listed above has incorrect size, check HD jumper setting
detection, and install the latest OS patches and disk drivers.


zavmat 01-30-2019 09:27 PM

You're 100% correct, there is the testdisk.log right there in the root directory. I'll try to get it to you

zavmat 01-30-2019 09:30 PM

Quote:

Originally Posted by rknichols (Post 5955276)
show(ing) the content of the tesstdisk.log file generated, either inline (wrapped in [CODE] ... [/CODE] tags please) or else attached as a text file.

I'm afraid I don't know how to do this [edit] directly through terminal that is...

[Edit] hang on it exceeded the limit...
[Edit 2] it exceeded the limit on pastebin too
[Edit 3] still no luck with compression, I guess I can upload it piecemeal? It's long as hell
[Edit 4] I'm trying to split the file with the split [options] command but with no luck

zavmat 01-30-2019 11:04 PM

3 Attachment(s)
Alright here's the testdisk.log files:

whansard 01-31-2019 01:03 AM

wipe the drive
 
Code:

dd if=/dev/zero of=/dev/sda
will wipe the drive.

zavmat 01-31-2019 01:06 AM

I trust your judgement but for the sake of understanding may I ask why? In layman's terms if possible?

rknichols 01-31-2019 08:52 AM

Quote:

Originally Posted by whansard (Post 5955786)
Code:

dd if=/dev/zero of=/dev/sda
will wipe the drive.

Since there is at least one OS installation that the OP wishes to recover, wiping the drive would be a fatal error.

zavmat 01-31-2019 08:56 AM

It seemed unnecessary to me, I defer to your guys' experierience on this though. Have you had a chance to take a look at the log files?

rknichols 01-31-2019 09:25 AM

Quote:

Originally Posted by zavmat (Post 5955931)
It seemed unnecessary to me, I defer to your guys' experierience on this though. Have you had a chance to take a look at the log files?

I'm looking right now. This is going to take a while.

zavmat 01-31-2019 02:13 PM

Thanks for taking the time, I really appreciate it.

rknichols 01-31-2019 04:38 PM

Apparently you told testdisk to write out a new partition table, since it no longer complains about no GPT or alternate GPT. No harm done.

There are multiple conflicting candidates, and I can't figure out which ones represent legitimate filesystems. It looks like that disk has gone through several repartitionings, and there are old filesystem headers scattered here and there.

Here is a script that you need to paste into a file and then execute with a shell. If you call the file "chkparts", then you just need to run "bash chkparts". The script will test 7 regions of the disk looking for valid filesystems. Post the result. Hopefully there will be a non-overlapping set there.
Code:

#!/bin/bash
Disk=${1:-/dev/sda}
trap '[ $Dev ] && losetup -d $Dev' 0
while read Start End Len Kproc
do
    BStart=$((Start*512))
    BLen=$((Len*512))
    Dev=$(losetup -f --show -o $BStart --sizelimit $BLen $Disk) || break
    echo $Dev $Start $Len
    $Kproc -n $Dev
    losetup -d $Dev
    Dev=""
done <<EOF
2048          411647    409600    fsck.vfat
673792          552939512  552265721 ntfsfix
552939519  1105205239 552265721 ntfsfix
1094012926 1400688637 306675712 fsck.ext4
1360289793 1412718592 52428800  fsck.ntfs
1400688640 1412714479 12025840  file -s
1412718592 1465147391 52428800  ntfsfix
EOF


zavmat 01-31-2019 07:30 PM

Here's the result:

Code:

[liveuser@localhost-live Desktop]$ sudo bash chkparts.txt
/dev/loop3 2048 409600
fsck.fat 4.1 (2017-01-24)
There are differences between boot sector and its backup.
This is mostly harmless. Differences: (offset:original/backup)
  65:00/01
  Not automatically fixing this.
/dev/loop3: 236 files, 29388/100352 clusters
/dev/loop3 673792 552265721
Mounting volume... OK
Processing of $MFT and $MFTMirr completed successfully.
Checking the alternate boot sector... OK
NTFS volume version is 3.1.
NTFS partition /dev/loop3 was processed successfully.
/dev/loop4 552939519 552265721
Mounting volume... ntfs_mst_post_read_fixup_warn: magic: 0x00000001  size: 1024  usa_ofs: 18311  usa_count: 0: Invalid argument
Record 0 has no FILE magic (0x1)
Failed to load $MFT: Input/output error
FAILED
Attempting to correct errors... ntfs_mst_post_read_fixup_warn: magic: 0x00000001  size: 1024  usa_ofs: 18311  usa_count: 0: Invalid argument
Record 0 has no FILE magic (0x1)
Failed to load $MFT: Input/output error
FAILED
Failed to startup volume: Input/output error
Checking for self-located MFT segment... ntfs_mst_post_read_fixup_warn: magic: 0x00000001  size: 1024  usa_ofs: 18311  usa_count: 0: Invalid argument
OK
Unrecoverable error
Volume is corrupt. You should run chkdsk.
No change made
/dev/loop3 1094012926 306675712
e2fsck 1.44.3 (10-July-2018)
ext2fs_open2: Bad magic number in super-block
fsck.ext4: Superblock invalid, trying backup blocks...
fsck.ext4: Bad magic number in super-block while trying to open /dev/loop3

The superblock could not be read or does not describe a valid ext2/ext3/ext4
filesystem.  If the device is valid and it really contains an ext2/ext3/ext4
filesystem (and not swap or ufs or something else), then the superblock
is corrupt, and you might try running e2fsck with an alternate superblock:
    e2fsck -b 8193 <device>
 or
    e2fsck -b 32768 <device>

/dev/loop3 1360289793 52428800
/dev/loop4 1400688640 12025840
/dev/loop4: Linux/i386 swap file (new style), version 1 (4K pages), size 1503231 pages, no label, UUID=61ad5052-79e3-4c26-b8c2-77698654e148
/dev/loop3 1412718592 52428800
Mounting volume... OK
Processing of $MFT and $MFTMirr completed successfully.
Checking the alternate boot sector... OK
NTFS volume version is 3.1.
NTFS partition /dev/loop3 was processed successfully.


rknichols 02-01-2019 10:38 AM

It looks like the Windows partitions have been located. At this point I don't see any recoverable Linux partitions. testdisk seems to have recovered the Windows partitions, but the type codes need to be changed. Using fdisk, change the type code for partition 1 to "1" (EFI System) and the code for partition 2 to "14" (Windows recovery environment).
Code:

[root@localhost-live ~]# fdisk /dev/sda

Welcome to fdisk (util-linux 2.32.1).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.


Command (m for help): t
Partition number (1-4, default 4): 1
Partition type (type L to list all types): 1

Changed type of partition 'Microsoft basic data' to 'EFI System'.

Command (m for help): t
Partition number (1-4, default 4): 2
Partition type (type L to list all types): 14

Changed type of partition 'Microsoft basic data' to 'Windows recovery environment'.

Command (m for help): p
Disk /dev/sda: 698.7 GiB, 750156374016 bytes, 1465149168 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: C90A303D-64AB-42B0-AD65-723707EA45E5

Device          Start        End  Sectors  Size Type
/dev/sda1        2048    411647    409600  200M EFI System
/dev/sda2      673792  552939512 552265721 263.3G Windows recovery environment
/dev/sda3  559239519 1105205239 545965721 260.3G Microsoft basic data
/dev/sda4  1360289793 1412718592  52428800    25G Microsoft basic data

Command (m for help): w
The partition table has been altered.
Calling ioctl() to re-read partition table.
Syncing disks.

[root@localhost-live ~]#

Hopefully, that will allow the Windows installation to boot. I'm not sure whether it's worthwhile trying to dig out Linux partitions. It doesn't appear that testdisk found anything else that it was happy with.


All times are GMT -5. The time now is 12:54 AM.