3

This is my gparted image

I want to resize /dev/sda5 to take all of the unallocated space (242.25 GiB). How can I accomplish this?

EDIT 1:

swapon output:
NAME         TYPE       SIZE USED  PRIO
/dev/sda6    partition  14G  0B        -1

sudo blkid | grep swap output
/dev/sda6: UUID="d4ae2fb5-2069-4b6d-b86d-e8c94ebf0fd9

grep swap /etc/fstab output:
# swap was on /dev/sda6 during reparation
UUID=d4ae2fb5-2069-4b6d-b86d-e8c94ebf0fd9 none swap sw 0 0
heynnema
  • 70,711
  • 1
    No way to do it without moving /dev/sda5 and the extended partition. I'd say it's easier to backup and reinstall. – mikewhatever Jan 14 '17 at 00:25
  • Is there a way to move it? I really don't fell like reinstalling it right now. – Marko vlaić Jan 14 '17 at 00:51
  • Yes, of course there is. Use the search function of the site. – mikewhatever Jan 14 '17 at 00:58
  • Before I give you detailed instructions, I need to know why I don't see a swap partition? How much RAM do you have? Is your computer a newer UEFI machine, or an older BIOS machine? – heynnema Jan 14 '17 at 02:03
  • ps: do you have any important files on sda5? Do you have a Ubuntu Live DVD with the same version of Ubuntu as you have installed now? Start all comments that are to my attention with @heynnema. – heynnema Jan 14 '17 at 02:14
  • @heynnema I don't have a swap partition because I disabled the option when installing ubuntu. I have 12 GiB of RAM. My computer is an older BIOS machine. And yes I do have an ubuntu live dvd. – Marko vlaić Jan 14 '17 at 12:54
  • @Markovlaić you really should have a swap partition, or a swapfile, even with 12G RAM. And to prove it to yourself, load up LibreOffice with a few documents, and Virtualbox with a few open VM's, etc and watch what happens to your system... it'll crash, hang, or just become very sluggish. I'll go and complete my answer below. – heynnema Jan 14 '17 at 13:49
  • @heynnema that you soo much, please save me! – Marko vlaić Jan 15 '17 at 13:30
  • @heynnema that was an autocorrect :D you saved me – Marko vlaić Jan 15 '17 at 13:51
  • @heynnema I dont have enough reputation yet since I opened my account few days ago, but I will sure remember to rate your answer when I gain some. – Marko vlaić Jan 15 '17 at 15:29
  • @Markovlaić did all the instructions work ok? Can you post a new updated gparted screenshot for me to see? – heynnema Jan 15 '17 at 15:34
  • @heynnema actually my computer now doesn't load graphics when I boot to ubuntu. Everything worked fine until I changed the fstab file. When the system rebooted I got a black screen with a terminal asking to log in. After I log in I am only able to use terminal. I also can't boot from live DVD for some unknown reason. Please help! – Marko vlaić Jan 15 '17 at 17:23
  • Log into the terminal and type swapon and sudo blkid | grep swap and grep swap /etc/fstab and tell me what the output is by editing your reply into your original question. Visually make sure that the UUID's in the 2nd and 3rd commands matches exactly. – heynnema Jan 15 '17 at 17:40

1 Answers1

0

Warning: FIRST backup all important files on /dev/sda5

To perform the required tasks, you'll need to have a Ubuntu Live DVD for the same version of Ubuntu that you have installed now.

Before (unallocated and sda4/sda5)

enter image description here

After (sda4/sda5 and swap)

enter image description here

In gparted:

  • boot to the Ubuntu Live DVD in Try Ubuntu mode

  • start gparted from the Unity dashboard

  • make sure that you're viewing the proper hard disk... if you only have one hard disk, it's probably /dev/sda

  • make sure it's set to align partitions on MiB boundries

  • note: the following steps may vary slightly and you should stay in contact if there are any difficulties or questions.

  • info: partitions are moved or resized in two different ways. The easy way is to use the graphic representation and use the hand cursor to drag/move partitions, and grab handles on the left/right sides of partitions to resize. The other way is to enter specific numeric values into the space before and space after entry fields. We'll use both methods here.

  • in the lower pane of gparted, right-click on sda4 and select move/resize

  • in the new window that appears, enter a 1 (one) into the space before and the space after numeric fields, then click OK

  • observe the graphic representation in the upper pane, and confirm that sda4 covers the previous unallocated space, and its original location, and that sda5 still only takes up a small portion of the left side sda4

  • if it doesn't appear as instructed, then STOP

  • if it does appear as instructed, click the Apply icon

  • right-click on sda5 and select move/resize

  • in the graphic representation, drag the right side of sda5 to the right, leaving 12-16G free space at the right, then click OK

  • in the bottom pane, right-click on the 12-16G of unallocated space that appears to the right of sda5, and select new logical partition, with a swap file system, sized to consume the entire 12-16G space, then click OK

  • compare the upper pane with the "After" image that I posted earlier, and if they don't look similar (the yellow portion represents swap), then STOP, if they do look similar click the Apply icon

  • note the sda representation of the new swap partition, it'll probably be sda6, you'll need that later when you edit /etc/fstab

In Ubuntu:

  • boot into Ubuntu

In terminal...

  • edit: type sudo mkswap /dev/sda6 changing sda6 to the sdaX number from the previous step, if required
  • type sudo blkid and note the UUID of the new swap partition, and copy it to the clipboard
  • type sudo cp /etc/fstab /etc/fstab.bak # to backup fstab
  • type gksudo gedit /etc/fstab # to edit fstab
  • add the following two lines to the end of fstab, changing the UUID to the one noted above, by pasting the clipboard
# swap was on /dev/sda6 during repartition
UUID=071f8b0e-8e16-4f4d-90ff-a4ae9cc56e2b  none  swap  sw  0  0
  • check your work, save the file, and quit gedit
  • type sudo swapon -a # to enable swap
  • type swapon and verify that it shows memory and swap
  • type reboot

In Windows:

  • boot into Windows
  • open the Power control panel
  • click on change what the power buttons do
  • click on change options that are unavailable
  • uncheck fast start
  • close the Power control panel
  • open an administrative command prompt window
  • type powercfg /h off (turns off hibernation)
  • type chkdsk /f c:
  • approve that chkdsk runs at next boot time
  • reboot Windows
heynnema
  • 70,711