1

My drive partitions are:

sudo parted --list
Model: ATA ST2000LM003 HN-M (scsi)
Disk /dev/sda: 2000GB
Sector size (logical/physical): 512B/4096B
Partition Table: msdos
Disk Flags: 

Number  Start   End     Size    Type      File system  Flags
 3      1049kB  215GB   215GB   primary   ext4
 1      215GB   1834GB  1619GB  extended               lba
 7      215GB   430GB   215GB   logical   ext4
 5      430GB   1215GB  785GB   logical   ntfs
 6      1215GB  1834GB  619GB   logical   ntfs
 2      1834GB  2000GB  167GB   primary   ntfs         boot

GUI partition map of same drive made with gnome-disks

  1. the partition 3 is used for /home/ folder of my Linux.
  2. The Partition 1 is contained three partition which it have:

    • Partition 7 as Mounted at Filesystem Root Partition 5 and 6 as
      Mounted at /media/root/ACAC8B5FAC8B23461 and Mounted at /media/root/EAD8A297D8A262151 which have my important personal
      data like projects and ...
  3. Portion 2 is NTFS — Not Mounted and i don't use it and don't know why configured with this big size?

As you can see, I have 167 GB free in Partition 2 (/dev/sda2) and it is not mounted (NTFS — Not Mounted). Can I combine it by my Linux portion /dev/sda3 and what consideration must be taken because main Linux partition is Ext4 type and free partition is NTFS?

Also this is one part of installing Ubuntu instead of Linux Mint LMDE 3 Cindy.

K7AAY
  • 17,202
Soheil Paper
  • 1,417
  • 1
    OK dude i have done it,(also sudo parted --list is correct) – Soheil Paper Nov 05 '19 at 16:24
  • 1
    Partition 2 cannot be 100% free, but may just have Windows boot files. Windows requires a primary NTFS partition to boot from and you cannot otherwise boot your logical NTFS partition. Safest is just shrink sda2 using Windows tools & run chkdsk which is required after any change. Then you can create a sda4 partition with gparted as a data partition and put some of your data from /home inside that. – oldfred Nov 05 '19 at 17:28

2 Answers2

1

Moving the edges of partitions can have potentially destructive consequences for data stored on that partition. Have viable backups.

It is easier to move the ending edge of a partition outward than it is to move the beginning edge of the partition, so it would be easier if you were attempting to expand a lower number partition into space formerly held by a higher number partition (given the usual order of partition creation).

Finally, when you expand a partition you expand that partition into unformatted empty space. Thus you would be required to remove the NTFS partition to make that space available for expansion by the EXT partition.

These are likely the most important considerations. With this being said and granting the caveats outlined above, the answer to your question is yes you can expand one partition to take-up the space formerly held by a neighboring partition. (Though given all of this you may discover a different course will prove better for your specific situation.)

JamesIsIn
  • 180
  • 2
  • 12
0

Please make a backup before making any changes, then verify the backup matches the source files; then, make another backup to different media (disk or cloud) and verify that before making any partition changes.

You have three major (Primary or Extended) partitions: 3, 1, and 2. NTFS Partition 2 looks like it booted Windows, and you specified you want to give up running Windows on this PC.

You can't take space from Partition 2 and give it to 3 because 1 is in the way. Partition 1 also hosts the Extended partitions 7, 5, and 6, which further complicates matters.

Number  Start   End     Size    Type      File system  Flags   Use

 3     1049kB   215GB   215GB  primary    ext4                 /home

 1      215GB  1834GB  1619GB  extended                lba  
  7     215GB   430GB   215GB   logical   ext4                 /
  5     430GB  1215GB   785GB   logical   ntfs                 data
  6    1215GB  1834GB   619GB   logical   ntfs                 data

 2     1834GB  2000GB   167GB  primary    ntfs         boot    unwanted

When you install your new Ubuntu, use Partition 3 as your root, and do not create (yet) a separate /home.

 3      1049kB   215GB  215GB   primary    ext4                 /

 1       215GB  1834GB  1619GB  extended               lba  
  7      215GB   430GB   215GB   logical   ext4                 /
  5      430GB  1215GB   785GB   logical   ntfs                 data
  6     1215GB  1834GB   619GB   logical   ntfs                 data  

 2      1834GB  2000GB   167GB  primary    ntfs        boot     unwanted  

After Ubuntu installation completes, delete partition 2 then add its space to partition 1. You will now have a partition layout like this:

 3     1049kB   215GB   215GB  primary     ext4                 /

 1       215GB  2000GB  1785GB  extended               lba  
  7      215GB   430GB   215GB   logical   ext4                 /
  5      430GB  1215GB   785GB   logical   ntfs                 data
  6     1215GB  1834GB   619GB   logical   ntfs                 data  
  x     1834GB  2000GB   167GB   unassigned

Create a new ext4 partition where the unassigned space 'x' is; should be partition number 8.

Exit from the drive partitioning software and reboot. Mount partition 8. Copy the contents of ~/ into the new ext4 partition 8. Shutdown, and re-boot with your LiveUSB, and return to partitioning.

Next, delete partition 7.

Move the location of partition 5 up to where partition 7 started.

Move the location of partition 6 to the end of partition 5.

Assign the remaining unused space at the end of partition 5 to the ext4 partition 8, where you copied your ~/ which results in a simpler layout:

 3     1049kB   215GB   215GB  primary    ext4                 /

 1      215GB  2000GB  1785GB  extended               lba  
  5     215GB   990GB   785GB   logical   ntfs                 data
  6     990GB  1609GB   619GB   logical   ntfs                 data
  8    1609GB  2000GB   391GB   logical   ext4                 to be /home

If you have unused space in partitions 5 and 6, you can reduce their size when you make the changes. If you don't believe you will use 215 GB for root, you can reduce its size as well, and move the starting point of the Extended partition (#1) up as well.

Lastly, make partition 8 your /home directory, take ownership of the directories and their files in the root of partition 8, and move them into your new ~/ for your new user created when you installed Ubuntu.

K7AAY
  • 17,202
  • I have updated it (Portion 2 is NTFS — Not Mounted and i don't use it and don't know why configured with this big size?) – Soheil Paper Nov 05 '19 at 16:57
  • Mr/Mrs @K7AAY, I need to do this because of many problem after upgrading my Linux mint LMDE, but i don't know your intent about making a recommendation, i need my PC and it is not for test or recommendation, also i don't know how or where i must to do it ( but asked some question here which you can see during my profile. – Soheil Paper Nov 05 '19 at 17:58
  • Well, we specialize in Ubuntu here, and Mint is different enough that giving recommendations can result in much unhappiness. Don't want to lead you astray by giving Ubuntu-specific recommendations, so Mint questions are off topic here "Questions that you should avoid: Linux Mint..." from https://askubuntu.com/help/on-topic . The Linux Mint forum is at https://forums.linuxmint.com/ or you can use http://unix.stackexchange.com – K7AAY Nov 05 '19 at 19:07
  • Are you saying this question is off topic? It have relation with Ubuntu, am i right? – Soheil Paper Nov 05 '19 at 19:12
  • @modern It is off topic unless you are converting to Ubuntu. – K7AAY Nov 05 '19 at 19:47
  • Dear @K7AAY already i have said which i am trying doing this. – Soheil Paper Nov 05 '19 at 22:28
  • thanks as can i see you have simulated the process in your PC !!! thanks a lot i appreciate your help and i get your answer,this question was as follows as my already question ,so i will doing and because of having dual-boot, i will do it based of this, and save my 3 portion or home to save my home folders . – Soheil Paper Nov 07 '19 at 19:29
  • @modern When you install Ubuntu, even if you use the exact same username, your files in ~/ will not be yours now, because Linux tracks the ownership based on a UUID which links to the username. You will still need to assert ownership after the Ubuntu install. – K7AAY Nov 07 '19 at 19:46
  • Thanks again for attestations, i have installed Ubuntu but i have some problem with NVIDIA driver which is asked here. – Soheil Paper Nov 08 '19 at 17:38
  • @modern Excellent! Breaking jobs down into bite-sized chunks (i.e., limiting the scope of questions) is highly desirable here. And, if you found my thoughts helpful, please click in the up arrowhead at the left of the top of an answer; if it was the ultimate solution, please also click on the checkmark to leave a trail for others with the same issue. – K7AAY Nov 08 '19 at 18:00