LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   moving and merging partitions (https://www.linuxquestions.org/questions/linux-software-2/moving-and-merging-partitions-4175531857/)

newbiesforever 01-22-2015 01:51 PM

moving and merging partitions
 
What software will move and merge disk partitions or unused sections? I moved all files on a partition to some other location, and don't need the now-empty partition anymore, so I want to delete the partition and consolidate it with the other unused space. I tried to do it in Gparted, but I guess it can't. I think I did it once with Partition Magic, but that was a long time ago and I have no idea if Partition Magic is around anymore.

syg00 01-22-2015 06:57 PM

Quote:

I tried to do it in Gparted, but I guess it can't.
Guess again. gparted is the tool for this.
What did you try, and what didn't work.

yancek 01-22-2015 08:02 PM

Post your partition information, the output of fdisk -l run as root.
To merge unallocated space with a partition it needs to be contiguous.
If you delete a logical partition, any logical partition with a lower number will have its partition number changed which can cause problems.
You need to unmount a partition before you can act on it.
Posting more info as requested would be your first step to get help.

newbiesforever 01-24-2015 08:08 PM

Code:

Disk /dev/sda: 160 GB, 160039272960 bytes
255 heads, 63 sectors/track, 19457 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

  Device Boot      Start        End      Blocks  Id  System
/dev/sda2            6528        8486    15727635  83  Linux
Warning: Partition 2 does not end on cylinder boundary.
/dev/sda3            8486      11097    20972857  83  Linux
Warning: Partition 3 does not end on cylinder boundary.
/dev/sda4          11097      19458    67159732    5  Extended
Warning: Partition 4 does not end on cylinder boundary.
/dev/sda5          11097      11880    6289447  82  Linux swap
Warning: Partition 5 does not end on cylinder boundary.
/dev/sda6          11880      13838    15727635  83  Linux
Warning: Partition 6 does not end on cylinder boundary.
/dev/sda7          13838      16449    20972857  83  Linux
Warning: Partition 7 does not end on cylinder boundary.
/dev/sda8          16449      19458    24169792  83  Linux
Warning: Partition 8 does not end on cylinder boundary.

Disk /dev/sdb: 7 GB, 7755890688 bytes
32 heads, 63 sectors/track, 7514 cylinders
Units = cylinders of 2016 * 512 = 1032192 bytes

  Device Boot      Start        End      Blocks  Id  System
/dev/sdb1  *          1        7514    7574080    b  FAT32
Warning: Unable to open /dev/sr0 read-write (Read-only file system).  /dev/sr0 has been opened read-only.
Error: /dev/sr0: unrecognised disk label

I don't need sda2 anymore, so I was going to delete it; then I was hoping to move it and the 50 MB unallocated space down to the bottom and merge them with the much smaller unallocated space.

yancek 01-24-2015 08:34 PM

sda4 is an Exteneed partition and sda5 - sda8 are logical partitions within the Extended partition. sda3 is between sda2 and sda4 so you can't merge them sda2 into the Extended partition, sda4. The easiest thing to do is to just use sda2 as a data partition. Is your system partition sda3? If it is and you moved the Extended partition to the left you would potentially create all kinds of problems.

newbiesforever 01-24-2015 08:56 PM

I keep my two Linux distros on sda6 and sda7 on the extended partition. Sda3 is my home partition. I keep rips of all my CDs on sda8. Well, I was afraid I couldn't move the empty space easily. That answers my question.

syg00 01-24-2015 09:51 PM

Quote:

Originally Posted by yancek (Post 5306287)
sda3 is between sda2 and sda4 so you can't merge them sda2 into the Extended partition, sda4. The easiest thing to do is to just use sda2 as a data partition. Is your system partition sda3? If it is and you moved the Extended partition to the left you would potentially create all kinds of problems.

I have to disagree - all Linux partitions can be moved safely/easily with gparted.
Delete sda2, move sda3 left, enlarge sda4, then shuffle the logicals as needed. I have done this several times - can be time consuming, but is safe. It is possible fstab and (especially) the bootloader may need some attention, but certainly do-able. Best done from a liveCD.

yancek 01-25-2015 08:33 AM

I was mistakenly assuming his system partition was on sda3 which would have created problems with booting, particularly for a new user. With his Linux distros on the logical partitions, it should not be a problem although I'm not sure about the 'easily' part of it for a new user. Given the needs of the OP and the structure, it would probably be simpler to delete sda2 and move sda3, the /home partition to the left.


All times are GMT -5. The time now is 09:23 AM.