LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 05-19-2020, 10:02 PM   #1
algray
LQ Newbie
 
Registered: Apr 2018
Posts: 19

Rep: Reputation: Disabled
Gparted and Disks reporting different partition tables


Hi there!

I made a major goof and wrote a debian.iso to /dev/sdb (actually what I remember doing is writing it to /dev/sda but for reasons I'll get into shortly, my disk is reporting it differently.

As I understand it, that means that the first 430Mb or so (size of debian-10 netinstall) has been overwritten by the iso file

So here's what I've come up with so far:

I have 2 drives:
Code:
- an HDD at /dev/sda. It is used for my data. It had an NTFS and an ext4 partition (no OSes)
- an SSD at /dev/sdb. It has a windows partition and a few linux partitions. While I could wipe the linux paritions. If I had to wipe the windows I probably
wouldn't be able to get it back (unfortunately I do still need to use it 
sometimes).
- on first error, the Bios was booting directly into the installer
using test disk:
Code:
- I don't remember the structure of the first 440 or so mB before I 
overwrote them. however, test disk appears to identify the partitions 
containing the OSes ok.
- test disk wouldnt let me use more than one logical partition so i had to make 
choose which partitions to "keep" in my new MBR
- After rewriting the changes to MBR using test. the BIOS no longer recognizes 
any bootable devices (but I can still boot into liveUSB)
using grub command-line (from a liveUSB, since BIOS can find the hard-drives)
Code:
- ls yields (hd0) (hd0,msdos1) (hd0,msdos0) (hd1) (hd1,msdos2) 
(hd1,msdos1) (hd1,msdos0) (hd2) (hd2,msdos4) (hd2,msdos3) (hd2,msdos2) 
(hd2,msdos1) (hd2,msdos0)
- ls (hd0) & ls (hd1) yield no response
- ls (hd2) yields debian-amd** (the name given to the usb .iso I originally 
overwrote the disks with)
from a liveUSB
Code:
- GParted and Disks report 2 different partition schemes for /dev/sdb
- Disks appears to show the partition table that I applied using testdisk
- GParted shows a single partition titled: debian-amd** same as what grub 
reported
Finally, using gdisk:
sudo gdisk /dev/sdb
Code:
GPT fdisk (gdisk) version 1.0.3

Partition table scan:
MBR: MBR only
BSD: not present
APM: not present
GPT: present

Found valid MBR and GPT. Which do you want to use?
1 - MBR
2 - GPT
3 - Create blank GPT
I saw from some posts that the GPT table can causes issue for the BIOS at boot-time and the BIOS is clearly confused. What options do I have to try and straighten this out?

Thank you, take care
Al Gray
 
Old 05-19-2020, 10:58 PM   #2
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,129

Rep: Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121
Which Windows ?. If Win10 was the device bought new as win10, or upgraded from Win7/8 (which) ?. This has relevance to both the firmware (BIOS vs. UEFI) and disk partitioning (MBR/DOR vs. gpt).
You keep referring to BIOS - is that because you know this is a BIOS based machine, or habit on your behalf ?.

gpt maintains 2 copies of the partition table, so you may be able to simply restore it in that case, although overwriting it with testdisk may make things interesting. Go here and see if that can give us some idea of the currrent setup.
 
Old 05-19-2020, 11:18 PM   #3
algray
LQ Newbie
 
Registered: Apr 2018
Posts: 19

Original Poster
Rep: Reputation: Disabled
Hey, thanks for the quick reply


Quote:
Which Windows ?. If Win10 was the device bought new as win10, or upgraded from Win7/8 (which) ?. This has relevance to both the firmware (BIOS vs. UEFI) and disk partitioning (MBR/DOR vs. gpt).
The computer (ASUS510U) was bought as new with windows 10 as the only OS.

Quote:
You keep referring to BIOS - is that because you know this is a BIOS based machine, or habit on your behalf ?.
When i open the BIOS menu (F2 on powerup), I'm presented with an interface titled:
ASUS BIOS Utility - EZ Mode
BIOS version: 309

Quote:
gpt maintains 2 copies of the partition table, so you may be able to simply restore it in that case, although overwriting it with testdisk may make things interesting. Go here and see if that can give us some idea of the currrent setup.
I've posted the output here:
https://pastebin.com/kJHH1J6x

A couple extra details I should mention(not sure how many will be relevant at this stage, or at all)
- Back when I was working from the premise of having overwritten /dev/sda, I performed grub-install on /dev/sda1. So that is the likely reason that you find a grub.cfg file in that location.
- /dev/sdb5 was my /boot drive previously. When I performed the write via testdisk, I gave it the boot flag.

Last edited by algray; 05-19-2020 at 11:23 PM. Reason: Add extra details I missed in the OP
 
Old 05-20-2020, 03:03 PM   #4
jefro
Moderator
 
Registered: Mar 2008
Posts: 21,985

Rep: Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626
"the partition table that I applied using testdisk"

Never trust a recovered disk?? Clean it and start over???
 
Old 05-20-2020, 08:06 PM   #5
algray
LQ Newbie
 
Registered: Apr 2018
Posts: 19

Original Poster
Rep: Reputation: Disabled
Quote:
Never trust a recovered disk?? Clean it and start over???
I've read enough to appreciate that this situation may not be recoverable. But I really don't want to have to go and buy a new version of windows. It's down to less than 5% of my needs at this point.
In fact, a 20-minute job on the windows partition is urgent and pending right now. Even though I hadn't had to use it at all during the last month. So very lucky timing on my part
 
Old 05-20-2020, 10:56 PM   #6
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,129

Rep: Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121
That is seriously ugly. One system thinks it was installed on a gpt disk, the other on msdos - same disk.
Can't imagine a fix - especially as there's a reference to gpt9. If I had to do a blind "get Win10 going" I'd use ddrescue to backup it up somewhere, then gdisk to convert it back to gpt, and see what I've got. Then get into the firmware (aka BIOS) screens and boot Win10 from there. Then first thing, create a system image - that allows you to install Win10 from scratch in need.
 
Old 05-20-2020, 11:24 PM   #7
algray
LQ Newbie
 
Registered: Apr 2018
Posts: 19

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by syg00 View Post
That is seriously ugly. One system thinks it was installed on a gpt disk, the other on msdos - same disk.
Can't imagine a fix - especially as there's a reference to gpt9. If I had to do a blind "get Win10 going" I'd use ddrescue to backup it up somewhere, then gdisk to convert it back to gpt, and see what I've got. Then get into the firmware (aka BIOS) screens and boot Win10 from there. Then first thing, create a system image - that allows you to install Win10 from scratch in need.
Sounds like I'm better off taking my battle to the shop who sold me the computer to try and get my Windows license key back.

This has been a very enlightening experience. Thank you!

Based on the bootinfo output of /dev/sda is there any reason to be concerned about that drive?

Last edited by algray; 05-20-2020 at 11:24 PM. Reason: typo
 
Old 05-20-2020, 11:40 PM   #8
algray
LQ Newbie
 
Registered: Apr 2018
Posts: 19

Original Poster
Rep: Reputation: Disabled
I guess as a couple follow-on questions, since I'll be starting from scratch.

- i believe I will overwrite /dev/sdb with zeros and then make an install from a LiveUSB. Is that the best way to do it?

- Am I better off with GPT or MBR? I don't remember seeing such an option on any debian-based intallers. But then again this will be my first time installing onto a blank hard drive so maybe I just never navigated to that part of the menu.

- Should the MBR be on /dev/sda? or /dev/sdb? if /dev/sdb, should i delete the grub.cfg from /dev/sda1?

- How does the BIOS find one or the other? I think it automatically recognizes bootable drives but didn't recognize mine because I'd broken it
 
Old 05-21-2020, 02:02 AM   #9
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,129

Rep: Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121
Most PC shops have no idea - they'll probably say you've voided your guarantee by even installing Linux. Which is utter b/s. It's generally considered better to install Windows first (although it's not necessary) - especially if the shop is doing it. No need to zero things, takes too long for no benefit - just delete all the partitions from a liveUSB and create a gpt partitiobn table on /dev/sdb. /dev/sda should be fine.
Make sure the firmware is set to UEFI (not "legacy" or whatever).

Any install will build a EFI partition (currently /dev/sdb5) or use one if already there. Don't worry about it, all done with mirrors ....
 
Old 05-21-2020, 09:05 AM   #10
rknichols
Senior Member
 
Registered: Aug 2009
Distribution: Rocky Linux
Posts: 4,779

Rep: Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212
You shouldn't have to worry about your Windows license. Just install from any Windows 10 installation disk (or download an ISO file disk image from https://www.microsoft.com/software-download/windows10), and do not provide a license key. When you first boot and connect to the internet, Microsoft will recognize that the previously licensed motherboard and activate the installation with a digital license.

Note that the ISO image will be too large for a 4.7 GB DVD (It will fit on a dual-layer.), and using Linux to make a bootable USB flash drive from that image can be difficult. It's easiest to use tools on a separate Windows installation to do that.
 
Old 05-21-2020, 11:18 AM   #11
teckk
LQ Guru
 
Registered: Oct 2004
Distribution: Arch
Posts: 5,138
Blog Entries: 6

Rep: Reputation: 1827Reputation: 1827Reputation: 1827Reputation: 1827Reputation: 1827Reputation: 1827Reputation: 1827Reputation: 1827Reputation: 1827Reputation: 1827Reputation: 1827
Quote:
When you first boot and connect to the internet, Microsoft will recognize that the previously licensed motherboard and activate the installation with a digital license.
Will it really? That's insidious. Shows how long its been since I used windows.
 
Old 05-21-2020, 01:51 PM   #12
rknichols
Senior Member
 
Registered: Aug 2009
Distribution: Rocky Linux
Posts: 4,779

Rep: Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212
Quote:
Originally Posted by rknichols View Post
When you first boot and connect to the internet, Microsoft will recognize that the previously licensed motherboard and activate the installation with a digital license.
Quote:
Originally Posted by teckk View Post
Will it really? That's insidious. Shows how long its been since I used windows.
Surprised me, too. I picked up a "Dead -- for parts only" motherboard on eBay. When it seemed to work quite well as a replacement for a truly dead one in a PC I had been given, I tried installing Windows 10. I expected a "not activated" complaint, but instead saw, "Windows is activated with a digital license." That board would have previously been running Windows 8.
 
Old 05-21-2020, 02:55 PM   #13
jefro
Moderator
 
Registered: Mar 2008
Posts: 21,985

Rep: Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626
"better off with GPT or MBR?"

If you have a modern system, modern OS, uefi, and 1Tb or larger disk then go with GPT.

There is actually three modes. GPT, MBR and a hybrid of both for some very few situations.

It should be possible to save off any data on this drive and fix it. MS has a few ways to save data/OS.
 
Old 05-21-2020, 11:09 PM   #14
algray
LQ Newbie
 
Registered: Apr 2018
Posts: 19

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by jefro View Post
"better off with GPT or MBR?"
If you have a modern system, modern OS, uefi, and 1Tb or larger disk then go with GPT.
Based on syg00's questions and my response above. The EFI/BIOS status on my system is a bit ambiguous to me. But I seem to remember features that I was used to associating with efi like needing to disable the lock on the device before I could boot from a liveUSB (I do remember a UEFI interface in Windows, didn't mention that up until now). I think ASUS's 'BIOS' interface is just using that term for nostalgia purposes or something.

At any rate, I'm gonna use gpt

Coming back full-circle to the title of this thread, I just used GParted to create a new GPT partition table.
That got both GParted and Disks agreeing to an empty /dev/sdb. Then I ran testdisk and several partitions were still recognized. So I've written them to a MBR using test disk. I'm going to have to post this before rebooting since im on the liveUSB.

This is experimental so I'll clarify a couple things:

Quote:
Microsoft will recognize that the previously licensed motherboard and activate the installation with a digital license.
While disconcerting, this is a relief for me in this case. It removes my last hesitation about wiping the drive and starting fresh (which I already understand I need to do anyway)

Quote:
Originally Posted by jefro View Post
It should be possible to save off any data on this drive and fix it. MS has a few ways to save data/OS.
Just to clarify, I don't care about recovering any of the data (or filesystem structures) on this drive. I'm more concerned with setting things up properly and having a stable system going forward.

Last edited by algray; 05-22-2020 at 12:09 AM. Reason: move portion to separate post
 
Old 05-22-2020, 12:07 AM   #15
algray
LQ Newbie
 
Registered: Apr 2018
Posts: 19

Original Poster
Rep: Reputation: Disabled
Creating the gpt table using gparted, then adding an MBR via test disk, cleared the issue and allowed me to boot from the partitions on /dev/sdb!

Based on what I've seen, I still want to wipe the drive fresh and implement a more easy to understand/manage partition table.

Since this has resolved the OP. I'm going to mark it as solved and open a new thread seeking advice on how to set-up a my own partition table, MBR and GRUB2 config.

Thanks everyone for the help!
 
  


Reply

Tags
gparted, testdisk



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: SystemRescueCd and GParted Live Now Based on GParted 0.24.0, Detect ZFS Filesystems LXer Syndicated Linux News 0 10-30-2015 08:42 AM
LXer: Tables of Contents, Indexes and Other Special Tables in Scribus LXer Syndicated Linux News 0 05-13-2011 05:30 AM
[SOLVED] df reporting 100% but du reporting 20% guna_pmk Linux - Server 1 04-15-2011 11:34 AM
kernel unable re-read partition table on disks when i start gparted penduleum Fedora 6 04-20-2010 06:56 AM
need a list of partition tables on as many disks as possible drkstr Linux - Software 4 08-03-2006 11:46 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 06:11 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration