3

Screenshot of gparted Three months ago I dual booted my PC with Windows 8 and Ubuntu 18.04.03. Now I'd like to reduce the size of the Windows partition and increase that of the Ubuntu partition. I can reduce the size of the Windows partition from the disks application, but between the unallocated space and the Ubuntu partition there is the swap partition, so I can't allocate the space to Ubuntu. Is there a way to get around the problem? EDIT:

I don't know why, but after shrinking the Windows partition both Windows and Ubuntu failed to boot, so since I had backed up my important files and didn't use Windows anymore I used the live USB to do a clean install. Thanks anyway for your advices

  • A windows swap partition, or Ubuntu? – JasonF4 Jan 03 '20 at 22:39
  • Honestly I don't even know what it is. I don't know much about partitions – Gabriele Terrana Jan 03 '20 at 22:41
  • It's an ubuntu swap partition – Gabriele Terrana Jan 03 '20 at 22:41
  • 1
    Should use Windows tools for Windows partitions. After Windows is shrunk, can delete or move the two small partitions over and increase ubuntu's size. Use the ubuntu installer USB and backup everything you don't want to lose. Moving partitions can be damaging to data. – crip659 Jan 03 '20 at 23:06
  • 2
    Does this answer your question? How to resize partitions? – karel Jan 04 '20 at 15:31
  • You do not actually have lots of space, Windows likes 30% free to run well and at 10% free a defrag may take forever as no working room. Another alternative is to use another ext4 or NTFS partition as a data partition and have some of your data you have in /home in the data partition. Does not have to be separate drive as these discuss: https://askubuntu.com/questions/1013677/storing-data-on-second-hdd-mounting & https://askubuntu.com/questions/1058756/installing-all-applications-on-a-ssd-disk-and-putting-all-files-on-hdd-disk – oldfred Jan 04 '20 at 15:42

3 Answers3

1

You can only extend your root Ubuntu partition to the left from a USB/CD boot, as the file system being moved can't be mounted at the time. You can use the USB/CD you used to install Linux. Back up critical data (documents,...) just in case. (You indicated in your post you could use Windows to shrink its own partition. Just as a note - it's best to shrink this partition from Windows, rather than GParted)

Once in the Ubuntu live setup, start GParted. Delete the swap partition (note its size). Then extend your root Ubunto partion to the left (click on the border line, and drag it over). Apply the change. This could take a long time, as it has to copy the data. Then recreate your swap partition. Apply the change. Done.

JasonF4
  • 548
  • 4
  • 16
  • Thanks. I'll try it, but how do I recreate the swap partition? – Gabriele Terrana Jan 03 '20 at 22:57
  • You have to create space on the right hand side. So reduce the size of the Ubuntu partion on the right. Then create a new partion, and set the type. (Check the type before you delete the swap partition by looking at its properties.) – JasonF4 Jan 03 '20 at 22:59
  • If you use 18.04 or newer, and do not use Hibernation in Linux, you can dispense with a dedicated swap partition and make a swap file instead, which is very much easier to upsize when you need to run an app which needs more virtual memory, and then downsize if you no longer need that app. HOWEVER if you use Hibernation, keep the swap partition. See https://askubuntu.com/a/1186786/197910 – K7AAY Jan 03 '20 at 23:38
0

Make sure that you have a good backup of your important Ubuntu files, as this procedure can corrupt or lose data.

Keep these things in mind:

  • always start the entire procedure with issuing a swapoff on any mounted swap partitions, and end the entire procedure with issuing a swapon on that same swap partition

  • a move is done by pointing the mouse pointer at the center of a partition and dragging it left/right with the hand cursor

  • a resize is done by dragging the left/right side of a partition to the left/right with the directional arrow cursor

  • if any partition can't be moved/resized graphically, you may have to manually enter the specific required numeric data (don't do this unless I instruct you to)

  • you begin any move/resize by right-clicking on the partition in the lower pane of the main window, and selecting the desired action from the popup menu, then finishing that action in the new move/resize window

Do the following...

Note: if the procedure doesn't work exactly as I outline, STOP immediately and DO NOT continue.

  • First, you must reduce the Windows C: NTFS partition, using the Windows Disk Management tool, to make room to resize your Ubuntu partition.
  • boot to a Ubuntu Live DVD/USB
  • start gparted
  • move /dev/sda7 partition left
  • move /dev/sda8 partition left
  • resize the right side of /dev/sda8 all the way right
  • click the Apply icon
heynnema
  • 70,711
  • Hi. I tried but I can't move any partition graphically – Gabriele Terrana Jan 06 '20 at 19:42
  • @GabrieleTerrana Did you boot to a Ubuntu Live DVD/USB first? Had you already reduced the /dev/sda4 Windows partition? – heynnema Jan 06 '20 at 22:12
  • I did boot an ubuntu live USB, but I didn't reduce the Windows partition since I thought I could do it after moving the partition. Also, the Windows disk management tool doesn't let me reduce the Windows partition more than 8 gigabytes – Gabriele Terrana Jan 07 '20 at 06:46
  • 1
    @GabrieleTerrana no, you must reduce your Windows C: partition to make room to increase your Ubuntu partition. Use the Windows Disk Management app. If it won't let you make it smaller than 8G, then you have to temporarily disable hibernation (full Windows shutdown), and your page file (System control panel), first. – heynnema Jan 07 '20 at 09:08
  • Are swapoff/swapon needed if the resizing is done from a live session? By the way, swap partitions are never mounted literally, they don’t show in the output of mount. – Melebius Jan 07 '20 at 09:18
  • @GabrieleTerrana see https://askubuntu.com/questions/145902/unable-to-mount-windows-ntfs-filesystem-due-to-hibernation for how to do this in Windows 8 or 10. – heynnema Jan 07 '20 at 09:19
  • @Melebius yes, as all swap partitions get mounted. – heynnema Jan 07 '20 at 09:20
  • Ok I'll try. Sorry but I'm really a newbie about all of this – Gabriele Terrana Jan 07 '20 at 10:10
  • @GabrieleTerrana Don't worry. I'll be here to help you. Once you get past the Windows partition resize, the rest is easy. – heynnema Jan 07 '20 at 14:24
0

I don't know why, but after shrinking the Windows partition both Windows and Ubuntu failed to boot, so since I had backed up my important files and didn't use Windows anymore I used the live USB to do a clean install. Thanks anyway for your advices