You are not logged in.

#1 2016-10-24 02:22:23

xsnake
Member
Registered: 2015-11-27
Posts: 11

Modification of partition table with parted

Hi,

I am performing an installation on a system with a hard drive currently partitioned as follows:

Number    Start    End    Size    Type    File system    Flags
1    32.3kB    210GB    210GB    primary    ntfs    boot
2    210GB    500GB    290GB    extended        lba
5    210GB    367GB    157GB    logical    ntfs
6    367GB    500GB    133GB    logical    ntfs

/dev/sda1 : start=    63, size=    409593177, type=7, bootable
/dev/sda2 : start=    409593240, size=    567158760, type=f
/dev/sda5 : start=    409593303, size=    307194867, type=7
/dev/sda6 : start=    716788233, size=    259963767, type=7

The only partition I need to keep is /dev/sda6, but as you can see it is the last logical partition of an extended partition (/dev/sda2).

Is there a way I could delete /dev/sda5 and then resize /dev/sda2 so that its start matches the start of /dev/sda6?

Or otherwise would it be simpler to just delete the extended partition and somehow convert /dev/sda6 into a primary partition?

Thank you.

Offline

#2 2016-10-24 06:56:22

olive
Member
From: Belgium
Registered: 2008-06-22
Posts: 1,490

Re: Modification of partition table with parted

I don't know with parted but it is easy to do with fdisk (which allow better control of what is really done). First list your partition table with "fdisk /dev/sda -l", be sure to have the output as sectors and print this out or put it on an external drive or usb key. Then launch fdisk and delete all partitions (this only delete the entry in the partition table, not the data on the partitions). Recreate the needed partition as primary with the same first and last sector as you have seen above.

Last edited by olive (2016-10-24 07:07:07)

Offline

#3 2016-10-24 19:55:18

xsnake
Member
Registered: 2015-11-27
Posts: 11

Re: Modification of partition table with parted

Thank you for your answer.

I am guessing that in addition to the steps you mentioned, I also have to set the exact same "System ID" on the partition for it to work, or is it irrelevant?

Thanks!

Offline

#4 2016-10-25 04:55:11

olive
Member
From: Belgium
Registered: 2008-06-22
Posts: 1,490

Re: Modification of partition table with parted

xsnake wrote:

Thank you for your answer.

I am guessing that in addition to the steps you mentioned, I also have to set the exact same "System ID" on the partition for it to work, or is it irrelevant?

Thanks!

The system id mention the filesystem that is on the partition. It is usually not used by Linux that autodetect the filesystem regardless of it. It is used by Windows so that it s indeed important to put the correct id with this OS. Anyway, even under Linux, it is better to put it correctly; so you are not confused when you launch tool such as fdisk.

Offline

Board footer

Powered by FluxBB