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 |
Quote:
|
not fdisk - check
need gdisk - nope need any partitioning tool that supports gpt - yes, e.g. PHP Code:
Distro installers commonly incorporate some variation of parted, which is also the basis of gparted, which operates from its own bootable media. |
Just curious, why a sun disklabel(?), if you're having Linux partitions.
Quote:
|
Quote:
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 Reference: https://unix.stackexchange.com/quest...ble-of-dev-sda |
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? |
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
|
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. |
Fedora 29, I'm booted to the live disk right now
|
Quote:
Further instructions coming once you've done that. |
Error
Code:
[liveuser@localhost ~]$ su - |
Do you have networking? What is the result from "ping -c1 mirrors.fedoraproject.org" ?
|
[root@localhost-live ~]# ping -cl mirrors.fedoraproject.org
ping: bad number of packets to transmit. |
Quote:
|
oops my mistate
Code:
[root@localhost-live ~]# ping c1 mirrors.fedoraproject.org Code:
[root@localhost-live ~]# ping c1 mirrors.fedoraproject.org Edit: it's downloading now. |
Quote:
Code:
dnf clean all |
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. |
alright test disk is officially installed! Sorry to take you down a winding road there...
|
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. |
looks pretty good to me, I'm just glad windows didn't get wiped...
Code:
TestDisk 7.0, Data Recovery Utility, April 2015 |
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. |
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 |
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.
|
It's analysing the cylinder as we speak, it's going to take some time like you said.
|
Here it is:
Code:
TestDisk 7.0, Data Recovery Utility, April 2015 |
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.
|
Now it's showing a ton of partitions, There's gotta be over 100
Code:
TestDisk 7.0, Data Recovery Utility, April 2015 |
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 |
Quote:
If the log file is large, consider using https://pastebin.com rather than posting or attaching it here. |
It brought me back to the select partition menu.
Edit: It's analyzing /dev/sda |
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 |
That looks like a pastebin of the screen display, not the testdisk.log file. I need to see the latter.
|
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?
|
Fedora 29 live has a partition program similar to gparted.
Edited out line. |
WFV suggested gparted, I'm unfamiliar with it though. All I have is Linux live right now.
|
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 |
Quote:
|
when I input testdisk /log /dev/sda in the root it yields this:
Code:
TestDisk 7.0, Data Recovery Utility, April 2015 |
You're 100% correct, there is the testdisk.log right there in the root directory. I'll try to get it to you
|
Quote:
[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 |
3 Attachment(s)
Alright here's the testdisk.log files:
|
wipe the drive
Code:
dd if=/dev/zero of=/dev/sda |
I trust your judgement but for the sake of understanding may I ask why? In layman's terms if possible?
|
Quote:
|
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?
|
Quote:
|
Thanks for taking the time, I really appreciate it.
|
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 |
Here's the result:
Code:
[liveuser@localhost-live Desktop]$ sudo bash chkparts.txt |
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 |
All times are GMT -5. The time now is 12:54 AM. |