Unable to move unallocated space to end of disk

Questions about other topics - please check if your question fits better in another category before posting here
Forum rules
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
Locked
Ernie Pantuso
Level 2
Level 2
Posts: 62
Joined: Tue Jun 26, 2012 11:46 am

Unable to move unallocated space to end of disk

Post by Ernie Pantuso »

My drive that was automatically partitioned by Mint 13 during installation...

/dev/sda1 - ext4 - /media/sda1 - 464.26GiB
/dev/sda2 - extended - - 1.50GiB
> /dev/sda5 - unknown - - 1.50GiB

I'm trying to shrink sda1 a bit, leaving some unallocated space at the end of the drive (just in case) in preparation for a disk clone operation where two 500GB drives are from different manufacturers.

Problem is, after I shrink sda1 and have some unallocated space after it, I can't figure out how to move sda2 so that unallocated space is at the end of the drive. No matter what I try, my choices are either to grow sda2 or leave the space in front of it. If I change "space before" to zero, it grows sda2. If I then set a value for "space after" and shift-tab back to the size for sda2, it resets space after to "1". If I specify a lower value for sda2 and then tab to space after, it automatically increases the space before.

I can't move, grow or resize sda5 because gparted has no idea what it is. (Maybe that's my problem?)
I'm curious, too, about sda3 and sda4... what the heck happened to them?

Thanks for your time and consideration.
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 1 time in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
remoulder
Level 17
Level 17
Posts: 7621
Joined: Fri May 09, 2008 1:14 pm

Re: Unable to move unallocated space to end of disk

Post by remoulder »

Is sda5 your swap, if not what is it? If swap then just delete it, move and resize the extended partition (or delete and recreate) then recreate swap.

N.B. you don't actually need to have the swap in an extended partition at all, it depends on what other partitions you intend to create if any.
[Edit] your original post and add [SOLVED] once your question is resolved.

“The people are my God” stressing the factor determining man’s destiny lies within man not in anything outside man, and thereby defining man as the dominator and remoulder of the world.
Ernie Pantuso
Level 2
Level 2
Posts: 62
Joined: Tue Jun 26, 2012 11:46 am

Re: Unable to move unallocated space to end of disk

Post by Ernie Pantuso »

Thanks for the response!

I don't know if sda5 is swap. What else would a 1.5GiB partition be?
I have no idea why Mint installer would have created swap within an extended partition, nor why it would use a partition type that gparted doesn't recognize. How can I confirm that this is swap?

If I do delete it and proceed with the resize, when I recreate it, won't it then be sda3? Where do I go to tell Mint about the new swap location? (Or will it pick it up automatically?) maybe it would be easiest to create very tiny partitions for sda3 and sda4, then create the swap, then delete sda3 and sda4? But I'm worried that if the partition type changes (which it certainly will) then Mint may not use it.
remoulder
Level 17
Level 17
Posts: 7621
Joined: Fri May 09, 2008 1:14 pm

Re: Unable to move unallocated space to end of disk

Post by remoulder »

Ernie Pantuso wrote:What else would a 1.5GiB partition be?
The automatic partitioning would create the swap in an extended partition. I can't imagine any other use, especially if it was created by the installer, though I don't understand why gparted doesn't recognize it as such in that case. Another thing that's puzzling is you describing sda1 as mounted under /media - is this drive your primary mint installation, as if so sda1 would be root.
Ernie Pantuso wrote:tell Mint about the new swap location
Yes you would need to edit your /etc/fstab to tell the system about the new swap partition. This has to be done afterwards. In the meantime let's try and verify what the partition is, open a terminal enter the following and copy/paste the outputs here

Code: Select all

sudo blkid
cat /etc/fstab
[Edit] your original post and add [SOLVED] once your question is resolved.

“The people are my God” stressing the factor determining man’s destiny lies within man not in anything outside man, and thereby defining man as the dominator and remoulder of the world.
Ernie Pantuso
Level 2
Level 2
Posts: 62
Joined: Tue Jun 26, 2012 11:46 am

Re: Unable to move unallocated space to end of disk

Post by Ernie Pantuso »

Thanks very much for the help!

Code: Select all

 ~ $ sudo blkid
/dev/sda1: UUID="cc0ed702-05f1-45ba-af76-e75e8b237001" TYPE="ext4" 
/dev/mapper/cryptswap1: UUID="ebd03542-4265-428d-a8b8-1a7b8ee79f66" TYPE="swap" 

 ~ $ cat /etc/fstab
# /etc/fstab: static file system information.
#
# Use 'blkid' to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name devices
# that works even if disks are added and removed. See fstab(5).
#
# <file system> <mount point>   <type>  <options>       <dump>  <pass>
proc            /proc           proc    nodev,noexec,nosuid 0       0
# / was on /dev/sda1 during installation
UUID=cc0ed702-05f1-45ba-af76-e75e8b237001 /               ext4    errors=remount-ro 0       1
# swap was on /dev/sda5 during installation
#UUID=a81ba9ab-ba2e-4b36-80e7-0b06f670aa44 none            swap    sw              0       0
/dev/mapper/cryptswap1 none swap sw 0 0
remoulder
Level 17
Level 17
Posts: 7621
Joined: Fri May 09, 2008 1:14 pm

Re: Unable to move unallocated space to end of disk

Post by remoulder »

Ok you have an encrypted swap, which is probably why gparted isn't reading it. This requires an addtional step as the UUID is specified in /etc/crypttab. If you 'cat' this file you should see the UUID of the swap partition you got from the blkid command. So if you delete the swap partition you need to replace the UUID in that file with the UUID of the new swap, you shouldn't need to edit fstab in this case. https://help.ubuntu.com/community/Encry ... ystemHowto might provide more info.
[Edit] your original post and add [SOLVED] once your question is resolved.

“The people are my God” stressing the factor determining man’s destiny lies within man not in anything outside man, and thereby defining man as the dominator and remoulder of the world.
Ernie Pantuso
Level 2
Level 2
Posts: 62
Joined: Tue Jun 26, 2012 11:46 am

Re: Unable to move unallocated space to end of disk

Post by Ernie Pantuso »

Do I need (want?) an encrypted swap? Seems like if I'm going to delete it then susequently recreate it, I'd create it as a normal swap and skip the encryption and extended partition. Only problem is, I don't know how to go about telling Mint about its new unencrypted swap...
remoulder
Level 17
Level 17
Posts: 7621
Joined: Fri May 09, 2008 1:14 pm

Re: Unable to move unallocated space to end of disk

Post by remoulder »

If you don't want the encrypted swap then you can move the # comment in /etc/fstab before UUID= ... swap to the beginning of the next line /dev/mapper ... swap, and replace the UUID value with the new one. We probably also need to delete or rename the /etc/crypttab file and unmount any kernel modules that have been loaded to support the encrypted filesystem.
[Edit] your original post and add [SOLVED] once your question is resolved.

“The people are my God” stressing the factor determining man’s destiny lies within man not in anything outside man, and thereby defining man as the dominator and remoulder of the world.
Ernie Pantuso
Level 2
Level 2
Posts: 62
Joined: Tue Jun 26, 2012 11:46 am

Re: Unable to move unallocated space to end of disk

Post by Ernie Pantuso »

hmmm. Sounds like maybe it'd be easier to just recreate the encrypted swap - but how?
remoulder
Level 17
Level 17
Posts: 7621
Joined: Fri May 09, 2008 1:14 pm

Re: Unable to move unallocated space to end of disk

Post by remoulder »

Ernie Pantuso wrote:but how
Read my earlier responses.
[Edit] your original post and add [SOLVED] once your question is resolved.

“The people are my God” stressing the factor determining man’s destiny lies within man not in anything outside man, and thereby defining man as the dominator and remoulder of the world.
Locked

Return to “Other topics”