Extend an extended partition into a primary partition

Kernels & Hardware, configuring network, installing services

Extend an extended partition into a primary partition

Postby 4joeyirosh1 » 2020-08-20 13:38

Hallo!I am running Debian 10.5 Buster 64 bit Linux.I have 4 primary partitions on my machine one of which includes an extended partition (check gparted screenshot attached) thus I cannot create any new partitions.

Image

I wanted to extend the extended partition /dev/sda4 to include primary partition /dev/sda3 so that now I have 3 primary partition and thus I can create a new primary partition.

Unfortunately,from gparted (even from bootable USB),I cannot extend the extended partition /dev/sda4 to include primary partition /dev/sda3 or move primary partition /dev/sda3/ into the extended partition.

How can I achieve what I wanted above to enable me create a new partition?
4joeyirosh1
 
Posts: 103
Joined: 2016-09-11 18:04

Re: Extend an extended partition into a primary partition

Postby bester69 » 2020-08-20 21:04

Very complicated, i thing that is not possible like you'd like to do..

you would need to move whole partition within extended partition .. if you had an external big usb disk, that would be very easy ... you could create a backup of first partition into external disk, then drop that partition in gparted, resize extended partition, create new partition within extended partiton and then restore backpap partition with command dd...., then you would need to reboot in a livecd , chrooy system partition and update-grub
bester69 wrote:You wont change my mind when I know Im right, Im not an ...
User avatar
bester69
 
Posts: 1806
Joined: 2015-04-02 13:15

Re: Extend an extended partition into a primary partition

Postby p.H » 2020-08-21 11:45

4joeyirosh1 wrote:I have 4 primary partitions on my machine one of which includes an extended partition (check gparted screenshot attached)

I cannot see the screenshot. Did you mean "which includes a logical partition" ?
4joeyirosh1 wrote:I wanted to extend the extended partition /dev/sda4 to include primary partition /dev/sda3 so that now I have 3 primary partition and thus I can create a new primary partition.

Why do you need to create a new primary partition ? Can't you create a new logical partition instead ?
You may be able to extend the extended partition /dev/sda4 to include /dev/sda3 with sfdisk if and only if there are at least two unallocated sectors before /dev/sda3 (this may require to shrink the previous partition and its contents). Can you post the output of
Code: Select all
fdisk -l /dev/sda

as root ?
p.H
 
Posts: 1521
Joined: 2017-09-17 07:12

Re: Extend an extended partition into a primary partition

Postby 4joeyirosh1 » 2020-08-21 12:04

p.H wrote:
4joeyirosh1 wrote:I have 4 primary partitions on my machine one of which includes an extended partition (check gparted screenshot attached)

I cannot see the screenshot. Did you mean "which includes a logical partition" ?


--Screenshot is in the first post I made on this topic.Here it is again

Image

4joeyirosh1 wrote:I wanted to extend the extended partition /dev/sda4 to include primary partition /dev/sda3 so that now I have 3 primary partition and thus I can create a new primary partition.
Why do you need to create a new primary partition ? Can't you create a new logical partition instead ?


---I need to create a new partition to install Windows 10 and have a dual boot machine.
You may be able to extend the extended partition /dev/sda4 to include /dev/sda3 with sfdisk if and only if there are at least two unallocated sectors before /dev/sda3 (this may require to shrink the previous partition and its contents). Can you post the output of
Code: Select all
fdisk -l /dev/sda

as root ?

Code: Select all
# fdisk -l /dev/sda
Disk /dev/sda: 931.5 GiB, 1000204886016 bytes, 1953525168 sectors
Disk model: TOSHIBA MQ01ABD1
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: dos
Disk identifier: 0x5e587546

Device     Boot     Start        End    Sectors   Size Id Type
/dev/sda1  *         2048   62916607   62914560    30G 83 Linux
/dev/sda2        62916608  104859647   41943040    20G 83 Linux
/dev/sda3       104859648  352323583  247463936   118G 8e Linux LVM
/dev/sda4       352325630 1951479809 1599154180 762.5G  5 Extended
/dev/sda5       499123548 1951479809 1452356262 692.6G 8e Linux LVM
/dev/sda6       352325632  373297151   20971520    10G 82 Linux swap / Solaris
/dev/sda7       373299200  499122175  125822976    60G 8e Linux LVM

Partition 4 does not start on physical sector boundary.
Partition 5 does not start on physical sector boundary.
Partition table entries are not in disk order.
4joeyirosh1
 
Posts: 103
Joined: 2016-09-11 18:04

Re: Extend an extended partition into a primary partition

Postby p.H » 2020-08-21 19:48

4joeyirosh1 wrote:Screenshot is in the first post I made on this topic.Here it is again

No need to post it again. I wrote that I could not see it (because the proxy blocked it) to warn that my reply may be inadequate, not that it was not there.

4joeyirosh1 wrote:I need to create a new partition to install Windows 10 and have a dual boot machine.

Where do you intend to create a new partition for Windows ? The disk does not have enough free unallocated space, only about 1 GB at the end.

There are no unallocated sectors between sda2 and sda3, so if you want to include sda3 in the extended partition you will have to reduce sda2 and its filesystem by at least 2 sectors for the new EBR.
p.H
 
Posts: 1521
Joined: 2017-09-17 07:12

Re: Extend an extended partition into a primary partition

Postby cuckooflew » 2020-08-21 22:11

There might be some other ways to approach this, more practical,(my opinion).
But no point in going into them if the OP is not interested in other options.
Also something to consider, and I may be wrong, since I don't use windows my self, and don't need it, also this was several years ago I did need to install it to a nephews, laptop....The laptop had Debian on it,and it had room for the new/extra partitions, but I still had a ton of problems. So,after researching it a little, what I read and found was the it is best, almost necessary to install windows first. I say almost, because I did find some blog style tutorials that claimed they were able to install windows 2nd, and still have the Debian/Linux partition working, I had no success with that, fortunately I did make good back ups and was able to recover the data that was on the Debian partition, so any way, consider researching that, I think you will find most techs recommend doing the windows install first. What you are trying to do is not likely to work, and you definitely need to have good back ups of everything important.
========
Good question, logically something to consider.
by p.H »Where do you intend to create a new partition for Windows ? The disk does not have enough free unallocated space, only about 1 GB at the end.

If you (the OP) are interested and willing to consider some other options, let me know, and really that is your only choice, if there is not enough room on the disk, end of story.
Why are 4 primary partitions even necessary ?
Hint: In order to have enough room on the HD for essentials, like the operating system, and software needed, they developed "storage devices", and we learned how to use the usb ports , etc,... My HD is 500 gb, yet I am often working with various OS's, and using 14 to 16 TB, of data files,and I do not use any "multi boot", but any way, the OP might not be interested so I will stop here,========== edited ====
If the OP wants to discuss some alternatives, please start a new topic for that.
Thanks
Last edited by cuckooflew on 2020-08-23 12:52, edited 1 time in total.
Please Read What we expect you have already Done
Search Engines know a lot, and
"If God had wanted computers to work all the time, He wouldn't have invented RESET buttons"
and
Just say NO to help vampires!
cuckooflew
 
Posts: 683
Joined: 2018-05-10 19:34
Location: Some where out west

Re: Extend an extended partition into a primary partition

Postby bester69 » 2020-08-23 10:19

cuckooflew wrote:There might be some other ways to approach this, more practical,(my opinion).
But no point in going into them if the OP is not interested in other options.
Also something to consider, and I may be wrong, since I don't use windows my self, and don't need it, also this was several years ago I did need to install it to a nephews, laptop....The laptop had Debian on it,and it had room for the new/extra partitions, but I still had a ton of problems. So,after researching it a little, what I read and found was the it is best, almost necessary to install windows first. I say almost, because I did find some blog style tutorials that claimed they were able to install windows 2nd, and still have the Debian/Linux partition working, I had no success with that, fortunately I did make good back ups and was able to recover the data that was on the Debian partition, so any way, consider researching that, I think you will find most techs recommend doing the windows install first. What you are trying to do is not likely to work, and you definitely need to have good back ups of everything important.
========
Good question, logically something to consider.
by p.H »Where do you intend to create a new partition for Windows ? The disk does not hav

e enough free unallocated space, only about 1 GB at the end.

If you (the OP) are interested and willing to consider some other options, let me know, and really that is your only choice, if there is not enough room on the disk, end of story.
Why are 4 primary partitions even necessary ?
Hint: In order to have enough room on the HD for essentials, like the operating system, and software needed, they developed "storage devices", and we learned how to use the usb ports , etc,... My HD is 500 gb, yet I am often working with various OS's, and using 14 to 16 TB, of data files,and I do not use any "multi boot", but any way, the OP might not be interested so I will stop here,


There is no problem at all in installing window after linux..Windows only need to see some primary partitions available, then after finished installation it will overwrite linux grub with its own boot loader.. so, you will need to use a livecd, chroot and install linux grub.. which will be able to recognize windows and create an enter for it... Ive never such kind of problem you talk about.. and dont see how anyone can have it unless its knowledges are very poor.

Image
Heres, you can see my hdd partition table,

sda1 (ntfs): Windows10
sda2 (btrfs):
/ root subvolime (system installation)
/home suvolume (home settings, hidden folders)
/media/cache (subvolume to use cache folder, and takec cache folder out of snapshots daily home)
/meda/DATA (work folder-subvolume; here, I have all my documents and data files, which are under scheduled daily backup)
/media/LINUXDEBS (here, I store software debs and programas files)
sda6(btrfs):
/media/kodivol (subvolume for keeping snapshot of kodi)
/media/sda6 (partition to keep home settings backup and other big files)
bester69 wrote:You wont change my mind when I know Im right, Im not an ...
User avatar
bester69
 
Posts: 1806
Joined: 2015-04-02 13:15

Re: Extend an extended partition into a primary partition

Postby cuckooflew » 2020-08-23 13:38

https://wiki.debian.org/DontBreakDebian#Don.27t_blindly_follow_bad_advice
Don't blindly follow bad advice

Unfortunately there's a lot of bad advice on the Internet. Tutorials found on blogs, forums and other sites often include instructions that will break your system in subtle ways. Don't simply follow the first advice you find, or the tutorial that seems the easiest. Spend some time reading the documentation and compare the difference between tutorials.

It's better to take the time to figure out the correct way to do something first than spending even more time fixing a broken system later. You would not let some random stranger feed your baby; do not execute commands without first understanding what they do.

Blog and forum posts don't expire. Instructions that might have been safe a couple of years ago might not be safe to follow any more. When in doubt keep researching and read your version's documentation.

Windows only need to see some primary partitions available, then after finished installation it will overwrite linux grub with its own boot loader.

https://www.pcworld.com/article/2955460/dual-booting-linux-with-windows-what-you-need-to-know.html
When you install Windows after Linux, Windows ignores Linux, doesn’t know how to resize its partitions, and overwrites the Linux boot loader with its own. You’ll have to repair the Linux system’s boot loader before you can boot back into your Linux system again. The Ubuntu wiki has instructions for repairing your boot loader, if you need to. You can always just reinstall Linux, too. But it’s best just to install Linux after Windows

https://www.howtogeek.com/214571/how-to ... n-your-pc/
How to Dual Boot Linux on Your PC
Anonymous View

5 Jul 2017 ... Linux is often best installed in a dual-boot system. ... Install Windows First: If you already have Windows installed, that's fine. ...

============
So,after researching it a little, what I read and found was the it is best, almost necessary to install windows first.

I did NOT say it is impossible, but why make things more complicated then necessary ?
Besides that, if there is not enough disk space, that is the end of it. Where are you going to install the windows ? You don't even really need windows any way.
And you need to realize, we get a lot of new Debian users here, some are very naive, and clueless, so then they see your comment
There is no problem at all in installing window after linux.

And they blindly go off and try it, only to discover they can no longer boot their Debian partition, and have no clue as to how to access the data they had, etc .. some are totally lost if they have to use the cli, etc,... So really , you should think twice before saying that, even if it is true, for many it will be a big problem when they find that they can not boot their system.
In this case , the OP might foolishly try it, installing Windows, and since there is not enough room on the drive, it will wipe the linux boot partition, and any other partition it thinks it needs to create space,...MS windows is evil malware, and extreme caution should be used when installing it to a HD that has another OS on it. The safest approach is to use a Virtual Machine, like QEMU/KVM, and install windows on that.
Or, just use a portable usb drive, and install it to that.But maybe ms malware does not support that like linux does, I don't know, ...don't care either.
Please Read What we expect you have already Done
Search Engines know a lot, and
"If God had wanted computers to work all the time, He wouldn't have invented RESET buttons"
and
Just say NO to help vampires!
cuckooflew
 
Posts: 683
Joined: 2018-05-10 19:34
Location: Some where out west

Re: Extend an extended partition into a primary partition

Postby sgosnell » 2020-08-25 02:49

You can't use sda3 for Windows? I don't know what's there, but you should be able to copy it to sda5. Or make a new logical partition and copy to that. Of course, that's going to mess with your lvm, but it should be possible. But you still have the problem of installing Windows after Linux with which to contend. Good luck with that.
Take my advice, I'm not using it.
sgosnell
 
Posts: 916
Joined: 2011-03-14 01:49

Re: Extend an extended partition into a primary partition

Postby bester69 » 2020-08-25 12:02

sgosnell wrote:... But you still have the problem of installing Windows after Linux with which to contend. Good luck with that.


What is that problem?? ..

Is this the problem you're talking about

0- reboot to livecd
1-
sudo su
mount -t ext4 /dev/sdaX /mnt
mount --bind /dev /mnt/dev
mount --bind /dev/pts /mnt/dev/pts
mount --bind /proc /mnt/proc
mount --bind /sys /mnt/sys
chroot /mnt
grub install /dev/sda && update-grub && exit

sudo reboot

:shock:
bester69 wrote:You wont change my mind when I know Im right, Im not an ...
User avatar
bester69
 
Posts: 1806
Joined: 2015-04-02 13:15

Re: Extend an extended partition into a primary partition

Postby 4joeyirosh1 » 2020-08-25 17:14

I gave up and just formatted my hard drive and reinstalled Windows then Linux :lol: :lol:
4joeyirosh1
 
Posts: 103
Joined: 2016-09-11 18:04

Re: Extend an extended partition into a primary partition

Postby LE_746F6D617A7A69 » 2020-08-25 21:25

4joeyirosh1 wrote:I gave up and just formatted my hard drive and reinstalled Windows then Linux :lol: :lol:

Naah, a better solution is to first install Debian and *not to* install Winblows (especially win10, unless in a KVM). I've wasted halve of my life trying to solve Winblows issues (v3.x ... v10) - and the best solution showed up is to install Debian GNU/Linux :)
... don't waste Your life for hopeless operating systems ... - it won't pay-off ...
Bill Gates: "(...) In my case, I went to the garbage cans at the Computer Science Center and I fished out listings of their operating system."
The_full_story and Nothing_have_changed
LE_746F6D617A7A69
 
Posts: 414
Joined: 2020-05-03 14:16

Re: Extend an extended partition into a primary partition

Postby bester69 » 2020-11-11 12:26

LE_746F6D617A7A69 wrote:
4joeyirosh1 wrote:I gave up and just formatted my hard drive and reinstalled Windows then Linux :lol: :lol:

Naah, a better solution is to first install Debian and *not to* install Winblows (especially win10, unless in a KVM). I've wasted halve of my life trying to solve Winblows issues (v3.x ... v10) - and the best solution showed up is to install Debian GNU/Linux :)
... don't waste Your life for hopeless operating systems ... - it won't pay-off ...

Until one day, you discover you need windows to be able to sign some adminsitration certificates in browser... cos Firefox, chrome are not supported in linux according adminsitration... You can always take car and drive out to a public cybercoffee and discover you cant install certificates neither there cos their browsers are restricted... and have a very bad day. :twisted:
bester69 wrote:You wont change my mind when I know Im right, Im not an ...
User avatar
bester69
 
Posts: 1806
Joined: 2015-04-02 13:15

Re: Extend an extended partition into a primary partition

Postby arzgi » 2020-11-11 16:46

bester69 wrote:Until one day, you discover you need windows to be able to sign some adminsitration certificates in browser... cos Firefox, chrome are not supported in linux according adminsitration... You can always take car and drive out to a public cybercoffee and discover you cant install certificates neither there cos their browsers are restricted... and have a very bad day. :twisted:


Don't know what I have done 'wrong', but has not happened to me. When I changed to Linux, I stil kept one Windows(r) installed in one pc, mainly to check if some usb gadget did work in Windows but not in Linux.

Over the years the usb support came better, and I realized have not booted or updated my Windows PC for almost two years, time to get rid of it :lol:
arzgi
 
Posts: 675
Joined: 2008-02-21 17:03
Location: Finland

Re: Extend an extended partition into a primary partition

Postby bester69 » 2020-11-19 14:09

arzgi wrote:
bester69 wrote:Until one day, you discover you need windows to be able to sign some adminsitration certificates in browser... cos Firefox, chrome are not supported in linux according adminsitration... You can always take car and drive out to a public cybercoffee and discover you cant install certificates neither there cos their browsers are restricted... and have a very bad day. :twisted:


Don't know what I have done 'wrong', but has not happened to me. When I changed to Linux, I stil kept one Windows(r) installed in one pc, mainly to check if some usb gadget did work in Windows but not in Linux.

Over the years the usb support came better, and I realized have not booted or updated my Windows PC for almost two years, time to get rid of it :lol:


look!!; Now I need to update my SSD's firmware..but they only provide Windows/Mac Software to flash the drive.... See??! :evil:
And they only offer 64bits software, and my cpu doesnt allow 64bits virtualization.. so I need to have a windows 7/10 installed in order to be able to flash my new ssd ... :x Told you!! windows is sadly neccesary unless you think of all scenaries...
>>I dont recommend to be without windows in another partition
bester69 wrote:You wont change my mind when I know Im right, Im not an ...
User avatar
bester69
 
Posts: 1806
Joined: 2015-04-02 13:15

Next

Return to System configuration

Who is online

Users browsing this forum: No registered users and 19 guests

fashionable