0

I am using Ubuntu 16.04 as dual boot along with Windows 10 in DELL XPS 9650. There is a media partition which I am not able to utilize (/dev/nvme0n1p9).

Partition information: Gparted

I am trying to resize and merge with / (root partition) but seems like its locked. Can anyone please let me know what's the use of media and how can i move the space from media to / (root) partition.

1 Answers1

0

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."

heynnema
  • 70,711
  • I chose to move the swap partition instead of removing and recreating it. Should you want to do so, you may have to turn Swap Off. –  Jun 25 '17 at 06:50
  • Thanks for your answer. is it possible to delete P10 (un-allocate) first then turn off swap and extended the root partition as suggested in https://askubuntu.com/questions/492054/how-to-extend-my-root-partition – data_nerd Jun 25 '17 at 07:20
  • You will have to mean sure Swap is Off for P10 before you can manipulate it. But do you mean to add both P9 and P10 to the root? Ubuntu can run without a swap partition as long as there is enough free RAM in your system (8GB+) and you don't run many applications. You can use 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:47
  • @Manish Everybody needs swap. You'll have to swapoff to move it, and swapon 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:01
  • First I did the swap off and added P9 and P10 to the root. After that i created the Swap partition. Everything is working fine, only issue ubuntu is taking much time to boot. – data_nerd Jun 26 '17 at 03:29
  • @heynnema I have created the Swap partition and checked swapaon --all but getting this error "swapon: cannot find the device for UUID=7a1a4513-6f6c-4ab0-bbe2-e0bc64d413bb" . I am able to boot, but do i need to edit /etc/fstab ? if so please let me know how it edit, I am not able to find UUID. – data_nerd Jun 26 '17 at 13:38
  • 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. – heynnema Jun 26 '17 at 13:56
  • @WillemK OP chose to delete/recreate swap. You may wish to edit your answer to include my comment on how to finish the swap recreation. – heynnema Jun 26 '17 at 14:01
  • @heynnema: ok, done. –  Jun 27 '17 at 15:27
  • @heynnema Thanks for your suggestion. I did a mistake, I have deleted the swap partition and extended my root drive. Now total 100 GB is in root, as I am still able to boot because of 16 GB RAM. is it still possible to create swap partition from root partition, i was trying to resize the root using gparted but not able to do so. Many thanks in advance. – data_nerd Jul 01 '17 at 05:26
  • @Manish: any gparted 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:36
  • It sounds like you didn't follow @WillemK or my instructionscompletely. Please post a current screenshot of gparted, and sudo blkid and cat /etc/fstab. – heynnema Jul 01 '17 at 13:34
  • Thanks for your help and patience. I followed the instructions and created the new swap partition. Cheers..!! – data_nerd Jul 04 '17 at 13:46