LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware
User Name
Password
Linux - Hardware This forum is for Hardware issues.
Having trouble installing a piece of hardware? Want to know if that peripheral is compatible with Linux?

Notices


Reply
  Search this Thread
Old 01-28-2018, 05:20 PM   #1
Gyroman
Member
 
Registered: Nov 2014
Location: Australia
Distribution: Mint 19.1 Toshiba Satellite Pro R50-C
Posts: 108
Blog Entries: 5

Rep: Reputation: 1
Can't delete HDD partition. Error: Can't have overlapping partitions.


Booting Windows XP PC with Linux Mint 18.3 bootstick to re-partition a ST380215A 80GB HDD and get a dual boot system.

I want to increase the Windows 21GB NTFS partition size to use most or all of this HDD as I have a second ST380215A 80GB on which to install Linux. Its just a blank partition and is ok.

There was an old Ubuntu system on the other partition(s) on the Windows 80GB HDD (installed after windows destroyed by malware) but somehow this part of the HDD ended up with multiple and overlapping partitions. The windows 21GB partition was ok so as advised I installed a fresh Windows XP SP3 on that 21G partition first then removed all the data from the Ubuntu partition booted with Linux Mint 18.3 USB to re-partition the remaining 60g of that drive.

One screen reported the whole 80GB drive was NTFS but I had comments that Linux could not be installed on NTFS partition but it appears it was and it worked! There are at least 4 partitions reported by Linux 'Discs' utility which used to show the overlapping partitions but now does not show it visually like that. The partitions reported (GUI) are..

/dev/sda1 (windows 21G)
/dev/sda2 (size ---, 0KB, unknown)
/dev/sda (58GB Free space)
/dev/sda3 (1.3GB Linux swap v1 not active)
/dev/sda (2.6MB Free space)

GParted (GUI) reports
"Can't have overlapping partitions" - press [ignore]
"Can't have a primary partition inside and extended partition" - press [ignore]
"Invalid partition table - recursive partition on /dev/sdc." - press [ignore]

GParted cannot apply partition delete actions reporting same errors as above.
 
Old 01-28-2018, 05:33 PM   #2
Gyroman
Member
 
Registered: Nov 2014
Location: Australia
Distribution: Mint 19.1 Toshiba Satellite Pro R50-C
Posts: 108

Original Poster
Blog Entries: 5

Rep: Reputation: 1
Update on visual layout of HDD

Attached is screen shot of visual partitioning of the 80G disc..
Attached Thumbnails
Click image for larger version

Name:	Screenshot at 2018-01-29 10-27-21.png
Views:	110
Size:	89.5 KB
ID:	26838  
 
Old 01-28-2018, 06:00 PM   #3
BW-userx
LQ Guru
 
Registered: Sep 2013
Location: Somewhere in my head.
Distribution: Slackware (15 current), Slack15, Ubuntu studio, MX Linux, FreeBSD 13.1, WIn10
Posts: 10,342

Rep: Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242
so delete the partitions that are not part of your windows xp OS then merge that into it, using windows to do so. Because if you're going to have window take back that space its best you let windows do it. then you can set up your other hdd for Linux how ever you like.
 
1 members found this post helpful.
Old 01-28-2018, 06:14 PM   #4
rknichols
Senior Member
 
Registered: Aug 2009
Distribution: Rocky Linux
Posts: 4,783

Rep: Reputation: 2214Reputation: 2214Reputation: 2214Reputation: 2214Reputation: 2214Reputation: 2214Reputation: 2214Reputation: 2214Reputation: 2214Reputation: 2214Reputation: 2214
Nothing appears wrong in that screenshot.

Please post the output from "fdisk -l /dev/sda" and also the output from "lsblk /dev/sda".
 
1 members found this post helpful.
Old 01-28-2018, 10:48 PM   #5
Gyroman
Member
 
Registered: Nov 2014
Location: Australia
Distribution: Mint 19.1 Toshiba Satellite Pro R50-C
Posts: 108

Original Poster
Blog Entries: 5

Rep: Reputation: 1
Thanks all.. Here are the outputs requested..
Attached Thumbnails
Click image for larger version

Name:	Screenshot at 2018-01-29 15-34-28.png
Views:	130
Size:	44.1 KB
ID:	26839   Click image for larger version

Name:	Screenshot at 2018-01-29 15-38-24.png
Views:	84
Size:	19.1 KB
ID:	26840  
 
Old 01-28-2018, 11:19 PM   #6
Gyroman
Member
 
Registered: Nov 2014
Location: Australia
Distribution: Mint 19.1 Toshiba Satellite Pro R50-C
Posts: 108

Original Poster
Blog Entries: 5

Rep: Reputation: 1
accidental post

Can't delete 'accidental' posts.. (sins of the soul) Ok..

My Windows XP does not have a partitioning tool and I can't find one in all my old Windows utilities.. thanks for the help however I think I will stay with the Linux tools and methods I just think they are more rigorous and reliable..

Last edited by Gyroman; 01-29-2018 at 05:11 PM. Reason: trying to delete accidental post
 
Old 01-29-2018, 07:46 AM   #7
BW-userx
LQ Guru
 
Registered: Sep 2013
Location: Somewhere in my head.
Distribution: Slackware (15 current), Slack15, Ubuntu studio, MX Linux, FreeBSD 13.1, WIn10
Posts: 10,342

Rep: Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242
Quote:
Originally Posted by Gyroman View Post
How do I delete this post..?

Nope.. [Edit/Delete] has no delete function..?
no deleting post... sorry you have to live with your mistakes just like in the real word.
 
1 members found this post helpful.
Old 01-29-2018, 07:54 AM   #8
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,930

Rep: Reputation: 7321Reputation: 7321Reputation: 7321Reputation: 7321Reputation: 7321Reputation: 7321Reputation: 7321Reputation: 7321Reputation: 7321Reputation: 7321Reputation: 7321
looks like sda3 is located within sda2 (the end block is the same). but sda3 is a primary partition, cannot be inside an extended partition.
It looks like you modified the end of the extended partition and now your partition table is invalid. You need to restore the original value (somewhere 153772031) and check consistency again. Afterward we can try to resize it again
 
1 members found this post helpful.
Old 01-29-2018, 09:13 AM   #9
rknichols
Senior Member
 
Registered: Aug 2009
Distribution: Rocky Linux
Posts: 4,783

Rep: Reputation: 2214Reputation: 2214Reputation: 2214Reputation: 2214Reputation: 2214Reputation: 2214Reputation: 2214Reputation: 2214Reputation: 2214Reputation: 2214Reputation: 2214
Quote:
Originally Posted by pan64 View Post
looks like sda3 is located within sda2 (the end block is the same). but sda3 is a primary partition, cannot be inside an extended partition.
Aye, that's the problem. Easiest way to fix it is by using sfdisk.

First, run "sfdisk -d /dev/sda >/tmp/parts" to dump the current partitioning onto a file. The contents of the file should look like this:
Code:
# partition table of /dev/sda
unit: sectors
/dev/sda1 : start=       63, size= 40960017, Id= 7
/dev/sda2 : start= 40962046, size=115334339, Id= 5
/dev/sda3 : start=153774243, size=  2522142, Id=82
/dev/sda4 : start=        0, size=        0, Id= 0
/dev/sda5 : start= 40962048, size=112809984, Id=83
Now, edit that file and change the size of partition 2:
Code:
# partition table of /dev/sda
unit: sectors
/dev/sda1 : start=       63, size= 40960017, Id= 7
/dev/sda2 : start= 40962046, size=112812196, Id= 5
/dev/sda3 : start=153774243, size=  2522142, Id=82
/dev/sda4 : start=        0, size=        0, Id= 0
/dev/sda5 : start= 40962048, size=112809984, Id=83
Finally, run "sfdisk --force /dev/sda </tmp/parts" to write the updated partitioning back to the drive. You should now have consistent partitioning that your GUI tools will accept.
 
2 members found this post helpful.
Old 01-29-2018, 12:58 PM   #10
cesarbergara
Member
 
Registered: Feb 2012
Location: Buenos Aires, Argentina
Distribution: Debian, Suse, Mandrake,
Posts: 92

Rep: Reputation: Disabled
Hi. Sometimes partition tool show primary partitions and logical partitions like diferent ones, but logical partitions always must be a part of one primary partition (for example:
/dev/sda: 40Gb
/dev/sda1: 10Gb
/dev/sda2: 16Gb
/dev/sda5: 9Gb
/dev/sda6: 7Gb
free space: 14Gb
(sda5 and sda6 are within sda2)

But if you have a drive with a MS NTFS plus other partitions, must be a better option to delete partitions (wich you dont use) and/or format them for data use only (is more easy to recover data from a partition without OS, because if you have a problem, you simple format and reinstall OS and data was safe out OS partition).

Have a nice day.
 
1 members found this post helpful.
Old 01-29-2018, 05:46 PM   #11
Gyroman
Member
 
Registered: Nov 2014
Location: Australia
Distribution: Mint 19.1 Toshiba Satellite Pro R50-C
Posts: 108

Original Poster
Blog Entries: 5

Rep: Reputation: 1
ran sfdisk -d /dev/sda/ >/tmp/parts and all looking good.. block numbers are spot on however there is no sda4 but I don't think that will matter.. But no vim or gedit..

What is the file editor on a Mint USB bootstick..?

Thanks so much..
 
Old 01-29-2018, 05:51 PM   #12
hydrurga
LQ Guru
 
Registered: Nov 2008
Location: Pictland
Distribution: Linux Mint 21 MATE
Posts: 8,048
Blog Entries: 5

Rep: Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925
Quote:
Originally Posted by Gyroman View Post
ran sfdisk -d /dev/sda/ >/tmp/parts and all looking good.. block numbers are spot on however there is no sda4 but I don't think that will matter.. But no vim or gedit..

What is the file editor on a Mint USB bootstick..?

Thanks so much..
xed
 
1 members found this post helpful.
Old 01-29-2018, 06:22 PM   #13
Gyroman
Member
 
Registered: Nov 2014
Location: Australia
Distribution: Mint 19.1 Toshiba Satellite Pro R50-C
Posts: 108

Original Poster
Blog Entries: 5

Rep: Reputation: 1
sudo sfdisk --force /dev/sda </tmp/parts

Whoa the output looks scary.. (even though I can loose the whole disk)..

try to reboot with Windows.. No go "Disc error".. rebooting with Mint bootstick.. that's ok but GUI Disks shows same picture as before..

Here's output of fdisk -l /dev/sda..
Attached Thumbnails
Click image for larger version

Name:	Screenshot at 2018-01-30 11-06-10.png
Views:	64
Size:	159.7 KB
ID:	26847   Click image for larger version

Name:	Screenshot at 2018-01-30 11-19-35.png
Views:	45
Size:	57.4 KB
ID:	26848  
 
Old 01-29-2018, 09:34 PM   #14
rknichols
Senior Member
 
Registered: Aug 2009
Distribution: Rocky Linux
Posts: 4,783

Rep: Reputation: 2214Reputation: 2214Reputation: 2214Reputation: 2214Reputation: 2214Reputation: 2214Reputation: 2214Reputation: 2214Reputation: 2214Reputation: 2214Reputation: 2214
Quote:
Originally Posted by Gyroman View Post
sudo sfdisk --force /dev/sda </tmp/parts

Whoa the output looks scary.. (even though I can loose the whole disk)..

try to reboot with Windows.. No go "Disc error".. rebooting with Mint bootstick.. that's ok but GUI Disks shows same picture as before..

Here's output of fdisk -l /dev/sda..
That final result is similar, but not the same as what you had before. Note that partition 2 now properly ends before the start of partition 3. You have to read those numbers pretty carefully to notice that.

Your sfdisk is somewhat noisier than my version, but nothing looks amiss. No, there is no partition 4. That partition 4 in the dump output (with all zeros) is just a placeholder for the nonexistent primary partition 4. There are 4 slots in the primary partition table, whether you are using all of them or not. The way Linux numbers partitions, logical partition numbers start with 5.

You will get that "Device or resource busy" error at the end if any partition on that drive is mounted or if you had another paritioning tool looking at that drive.

It looks like the problem with Windows not booting is because sfdisk gratuitously changed the disk identifier from 0xf460f460 to 0x74b97029. Windows gets very upset about that. You can try using fdisk to change that back. In the "expert" menu ("x" command to get there) it's the "i" command. I hope your version of fdisk is better than mine at that. Mine claims to make the change, but it never shows up on the disk. I have to resort to a hex editor to adjust that. The identifier is 4 bytes starting at offset 0x1B8 in the MBR. It's little-endian -- byte order reversed from what fdisk displays. Good luck with that.

Last edited by rknichols; 01-29-2018 at 09:39 PM.
 
1 members found this post helpful.
Old 01-30-2018, 04:30 AM   #15
Gyroman
Member
 
Registered: Nov 2014
Location: Australia
Distribution: Mint 19.1 Toshiba Satellite Pro R50-C
Posts: 108

Original Poster
Blog Entries: 5

Rep: Reputation: 1
Quote:
Originally Posted by rknichols View Post
It looks like the problem with Windows not booting is because sfdisk gratuitously changed the disk identifier from 0xf460f460 to 0x74b97029. Windows gets very upset about that. You can try using fdisk to change that back. In the "expert" menu ("x" command to get there) it's the "i" command. I hope your version of fdisk is better than mine at that. Mine claims to make the change, but it never shows up on the disk. I have to resort to a hex editor to adjust that. The identifier is 4 bytes starting at offset 0x1B8 in the MBR. It's little-endian -- byte order reversed from what fdisk displays. Good luck with that.
I am going to need some specific help here.. can't see 'x' on man fdisk I also know nothing about GPT or how to verify GPT or MBR etc..

Thanks..
 
  


Reply



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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
overlapping partitions micder Slackware 4 11-26-2012 11:47 AM
gparted error - can't have overlapping partitions zetrotrack000 Linux - General 5 02-04-2012 08:49 PM
[SOLVED] Overlapping Partitions CincinnatiKid Linux - General 5 09-01-2010 10:15 AM
HDD partition recovery - HDD works but no partitions are accessible? stevod333 Linux - Software 6 10-01-2009 05:24 AM
Cannot Delete incomplete partitions or Start HDD truhuska Linux - Software 4 04-30-2004 11:43 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware

All times are GMT -5. The time now is 02:53 PM.

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