0

I'm trying to expand dev/sda7/ space using unlocated memory[587GB]. I'm not able to expand dev/sda7/ to unlocated memory resize option won't show the memory of unlocated. Is there a way to push unlocated memory into extended partition and resize dev/sda7 memory from there? gparted image from live ubuntu

K7AAY
  • 17,202
  • I want to merge the top unallocated size of 587 GB, is there a way to bring into extended partition?? @Rinzwind – Nikhil R Feb 13 '20 at 07:22
  • what does gparted say when you tell it to merge with 4? – Rinzwind Feb 13 '20 at 07:33
  • Run sudo parted -l in a terminal to make a list of your partitions, then come back here, click [edit], and paste the results into your question. It's far easier to read that then to look at a skewed photo of a screen with moire pattern interference. – K7AAY Feb 13 '20 at 18:02
  • An alternative is to just make it an ext4 partition and either move /home to it or make it a data partition and move some of the larger folders in /home into it and link those back. To move /home uses rsync- Be sure to use parameters to preserve ownership & permissions https://help.ubuntu.com/community/Partitioning/Home/Moving Create data partition, shows different drive, but can be on same. https://askubuntu.com/questions/1013677/storing-data-on-second-hdd-mounting & https://askubuntu.com/questions/1058756/installing-all-applications-on-a-ssd-disk-and-putting-all-files-on-hdd-disk – oldfred Feb 13 '20 at 18:40
  • thanks guyz for all of your answers. I was able to successfully do the partition. – Nikhil R Feb 14 '20 at 16:00

1 Answers1

0

You are not able to do it because your extended partition table starts in the middle of the disk and there is no more room in your extended partition table.

No standard tool allows you to do what you want to do. But it is possible.

It is very difficult to give you exact commands for two reasons:

  1. There is not enough information at the moment.
  2. It is a risky process, it can go wrong - loosing all data.

But I can give you an idea how you can solve it.

BACKUP FIRST!

First you need to save your partition schema:

sudo fdisk /dev/sda

use command p in fdisk to print partition table. Copy-paste it and keep it safe. You WILL NEED IT! And SAFE means better save it USB stick or some other external storage and not to the disk you are about to modify. You can print it too.

Next, you need to create new partition table, that is o command in fdisk. You will end up with empty partition table - everything is gone! That is normal and no need to worry about it. Everything will keep working as long as you stay in fdisk.

Next you create new extended partition table, that is n (like new) and e (like extended) commands. You can choose any number you want (1-4) or you can look up what sda+number you had previously - that is entry in partition table with type Extended. It should not matter but to be sure, use the same number.

Now you have extended partition table across your whole disk. But still no partitions.

Next you re-create sda5-sda7 partitions. It THAT ORDER!

Choose n (like new) and l (like logical). Enter sda5 Start from your saved info as value to First sector Enter sda5 End from your saved info as value to Last sector

If you get message like this location has file system marker and do you want to clear it then answer NO! Or you will loose your filesystem. DO NOT CLEAR! This is very important.

Repeat the same steps again. Next one will be for sda6 and then sda7.

If one of your partitions had Boot flag - that is (*) in Boot column in saved fdisk info, then add that back. a command will do that.

You can use p command again to verify that sda5-sda7 look EXACTLY the same as in saved info. If not, go make corrections. As long as you are in fdisk and have not saved anything you can start again by making empty partition table with o command.

If you need to change type then that is done with t command. Default is 83 Linux and that is ok for most linux data partitions, except swap should be 82 Linux swap.

If everything looks ok and ALL START/END/SIZE NUMBERS MATCH EXACTLY, only then you can use w command to write it to disk.

If everything went well, you have extended you extended partition table. Try to reboot and if everything starts ok, you have not broken anything.

Even after that you still have the same situation like before - with the exeption that now you can move/resize sda7.

Open gparted or any other GUI partition tool of your choice and move sda7 to start of the disk and then resize it to use all available space. But that again is a process that has possibility to go wrong. So BACKUP first!

And again. This is very risky operation, specially if you are unsure what you are doing and why. Just a little mistake, like a typo when entering numbers can cause you to loose access to partitions or even worse, loose data!

Another important note!

You can only resize partition if free space right AFTER the partition on the disk. So after all that you need to move your partitions around so all free space is right after the partition you want to resize. I assumed that sda7 is the first partition on your disk (that means start sector is the smallest number). If not, you have to move every partition.

So yes, it can be done. But it is difficult and there is a high chance that a small mistake can cost you all your data.

If you do not feel ok with this procedure - do not do it!

srx
  • 11
  • Making partition changes is the easiest way to lose all the data on a drive. Please always make a backup to an external drive then verify what's on the backup matches the source files. Then make another backup to a different external drive or the cloud and then verify what's on backup #2 matches the source files. Only then should you make any partition changes. – K7AAY Feb 13 '20 at 18:00