How can I move my existing EFI and swap partitions to the end of the drive?

I’ve been using linux full time for a while now, though I’m still dual booting with windows and I want to dedicate more space to linux.
Currently, my partitions in this order:
100MB EFI Partition (windows)
~500GB NTFS Partition (windows)
512MB EFI Partition (linux)
8GB swap partition (linux
~500GB EXT4 partition (linux)

What I want is to move the linux EFI and swap to the end of the drive, so I can shrink my NTFS partition and grow the EXT4 to fill the space, though I’m not sure if that would be the best way to accomplish this. All I really want is to get more storage space on linux without needing to reinstall either OS if at all possible.

1 Like

Shrinking, growing, and moving partitions is inherently risky. I am risk-adverse. Hence, my suggestion is to add another hard drive or ssd and mount the space into the existing Linux filesystem. Others may come along and suggest other alternatives. Just my 2 cents. :slight_smile:

3 Likes

can you return

sudo parted -l

For avoiding moving around partitions and thereby eliminating the possibility of data loss or corruption, you could shrink your NTFS partition from within your Windows system.

After, from your Linux, make an EXT4 partition of that liberated space and mount it somewhere convenient to you in the filesystem.

You could look up fstab in the ArchWiki for how to add an entry for this new partition with some mount options suited to your intention.

1 Like

I have a bunch of drives installed currently, /dev/nvme0n1 is the one that matters

To expand on the previous suggestion - once you have shrunk the Windows partition from within Windows, and made the freed up space in a separate ext4 partition, I would do the following:

  1. copy the current ext4 contents into the new partition (once you have it mounted in fstab) - space permitting
  2. Change your /etc/fstab to point to the ‘new’ space instead of the old and reboot. Then also mount the OLD partition as something like /mnt/data
  3. Remove from the OLD partition everything except the standard data directories (Documents, Downloads, Music, Pictures, Videos - and any others you may have (I have Books as an extra for example))
  4. Remove those same directories on the new partition, and replace them with soft (or hard) links to the old partition equivalent which still holds the data. For example, given you are located in the new partition (/home/username) this command will soft link Music to the different location: ln -s /mnt/data/Music Music - assuming you have things mounted on /mnt/data of course!

This will mean that the directory will APPEAR as if it is still in the home directory, and will act as normal - but will in fact be in the old place. This makes it much easier to select for backups of your data, (as the data might well not change as often) and gives you more room for it without ever having to do anything drastic…

As I said, that’s what I would do - your machine your choice!
:grin:

1 Like

Make sure you back up absolutely everything you don’t want to lose.

This is arguably the most dangerous thing you can perform while trying to not reinstall and the likelihood of losing some or so information is very high. Moving partitions is inherently risky. This has come up several times over the years, there’s definitely other searchable threads here where people tried this that can give you more insight.

Make a complete backup. I said it again.

Expect to lose everything and if it does workout, you’re golden and if it doesn’t work out, you’re safe still.

Good luck.

I can only echo what others have said.

In the past I have taken the approach of resizing the Windows partition, but its still far too risky. You will be much happier and confident in your build if take the advice given. The only way to be really confident is to back up eveything you cannnot afford to lose and start over. I finished up losing the Windows partition completely and that is how I finished up on a Linux only partition system. Of course I was still able to retrieve the Windows data files to an external drive before losing the Windows boot partition in GrUB, but I still started with a brand new setup, and have not had a problem since, and that was February. It was also liberating to to be able to function without anythng from Microsoft :rofl: if that’s also your goal.

1 Like

As said here, do a backup of all your data (at least the data, operating systems can be re-installed…).

Here’s some things to consider:

  • After shrinking the Windows partition, re-installing linux could be a reasonable way to proceed. Otherwise you need to manually make sure the UUIDs of partitions in files /etc/fstab and /boot/grub/grub.cfg are correct.
  • Check if the content on the linux EFI partition would fit in the Windows EFI partition. That could save some space too.
  • Swap partition can be replaced with a swap file. This is easy to choose when re-installing. But if you have lots of RAM, then swap might not be needed at all (also depending on what apps you use and how).
1 Like

I suggest you don’t try to move or alter the EFI partition or any partition created by Windows. I am also risk averse so I stick to a simple formula: If you simply MUST dual-boot on a single drive, then use Windows disk manager to shrink the primary NTFS partition. Be sure to leave a little headroom though. After that, install Linux on the un-allocated space. If you choose the “do something else” option on the Calamares installer you can manually create a swap partition if you want. I always do, but it’s probably unnecessary. During the install, Linux will hijack the little 100MB EFI partition but that’s OK. On startup you’ll be greeted with a graphical boot manager that gives you a few seconds to choose Windows or Linux. I’ve used this plan on several desktop and laptop machines, both SSDs and spinners, using dozens of different Linux distros and it has always worked fine. Even so, my working assumption is that it will fail and I will lose my Windows install, so I keep all my files backed up. I have tried to fully relocate (both beginning and end) Windows and Linux partitions using GParted. It always takes a looong time and it fails more often than not. I advise against it.

1 Like
  1. Get an external drive (USB-HDD or -SSD) on which to backup everything.

  2. Get a large enough USB stick and copy the ISOs you want. (Alternatively you can also use a USB HDD/SSD.)
    Ventoy is a very good tool to use for such a purpose that resolves any trouble multibooting of many ISO-files easily. Be sure to include Gparted-LiveISO and Clonezilla-LiveISO on your USB-stick or -drive.

From there, you’re free to go any direction you want!

  1. Boot Clonezilla live on your (Ventoyed) USB to backup your old partitions to the new external USB drive, HD or SSD, the one to contain all your backups.

  2. Then use Gparted live, again from USB to layout your partitions on the old (internal) drive.

  3. Do clean installs on to the newly created partitions on your old internal drive… all from your Ventroy stick or drive.

  4. Restore your needed files from the backups to the newly installed system(s).

P.S. - If you decide for a thumb drive, storage and read/write speeds matter.

:laughing:

1 Like

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.