The root is locked because your Ubuntu is running from it.
/media/ is the mountpoint for automounting USB drives, a.o. Currently your P9 is also mounted there.
You must boot from the Ubuntu Live USB to be able to manipulate the root partition. Unfortunately the swap partition P10 is in between P8 and P9, so the required actions are a bit more than you might expect:
NB
The actions you are about to take can irreversibly corrupt your system.
Make sure you backup any files you don't want to lose !!
- As said, boot from Live USB, select the Try Ubuntu option.
- Start
gparted
- Select P9 and delete it. Execute (Green tick).
- Select P10, Resize/Move, select the slider in the middle and move it to the right. Execute. You should now have Unallocated space between P8 and P10.
- Select P8, Resize/Move, select the right arrow of the slider and move it to the right. The size indicator should grow. Execute. You should now have a larger root.
- Exit
gparted
and reboot the system.
Addition as suggested by heynnema (also see comments):
"In terminal issue a sudo mkswap /dev/new_swap_partition_name_here, note the new UUID. Edit that UUID into /etc/fstab with gksudo gedit /etc/fstab and edit the line with "swap" in it. Replace the UUID that's there now. Save the file and quit gedit. Then type swapon -a. Then use free -h and swapon to confirm swap usage."
top
in a terminal to check that. However I would choose to have at least some swap space of 4-8GB. – Jun 25 '17 at 07:47swapoff
to move it, andswapon
when it's moved. If you delete it, or delete it and recreate it, you'll also have to edit /etc/fstab or you may not be able to boot. – heynnema Jun 25 '17 at 14:01terminal
issue asudo mkswap /dev/new_swap_partition_name_here
, note the new UUID. Edit that UUID into /etc/fstab withgksudo gedit /etc/fstab
and edit the line with "swap" in it. Replace the UUID that's there now. Save the file and quit gedit. Then typeswapon -a
. Then usefree -h
andswapon
to confirm swap usage. – heynnema Jun 26 '17 at 13:56gparted
actions on your new root must be done when booted from Live USB. When you have shrunk the root, I'd suggest by 16GB, you can boot your system again and then use the Disk Utility to create the swap. By using its Mount Options you don't have to manually edit the /etc/fstab. – Jul 01 '17 at 09:36sudo blkid
andcat /etc/fstab
. – heynnema Jul 01 '17 at 13:34