Improper Ubuntu setup / partition of system disk is causing issues

Q: How do I assign app or snap installs to the data area verses the system or boot area on the same disk?

I’ve managed that with symlinks for data, Pictures, Music, and Documents, but installs of new apps and snaps seem to be routed to my boot or system area; a much smaller area, about a tenth of the storage space. I’ve found the system warning me that I’m running out of space and I’m nowhere near setup of the apps and peripherals I need on the system; therefore, there is a need to re-route new apps installs to the larger storage area as originally intended.

m2 drive; 500Gb, (4) partitions:
nvme0n1 465.8G /dev/nvme0n1
├─nvme0n1p1 37.3G swap /dev/nvme0n1p1 [SWAP]
├─nvme0n1p2 28G ext4 /dev/nvme0n1p2 /
├─nvme0n1p3 37.3G vfat /dev/nvme0n1p3 /boot/efi
└─nvme0n1p4 363.3G ext4 /dev/nvme0n1p4 /home

I’d like new installs to be routed to the “nvme0n1p4” (p4) partition, but they seem to be routed by the system to “p2” or “p3”. How is this best addressed?

What I read online for installing Ubuntu/Linux was that partition needed to be no larger than 20Gb… and I doubled it to 40Gb (yes I have trust issues… moving on…). Now I’m having storage space issues (trust issues vindicated, ;-D) I deleted all programs I don’t use, buying myself some time; but this issue needs addressed for the long-term system integrity.

I imagine I can reroute the directories in /home/[user] by means of symlinks for each /home/[user] directory, but that seems a rather ham-handed, in-elegant means to achieve such; just my style… but looking to learn more effective methods.

NOTE: there are no tags in Discourse for “partitions” or “setup” which might more aptly describe this issue (and I don’t have permissions to create them that I can see).

Does this help ?

I thought the latest install size was 32GB as a minimum for an install. I don’t make partitions manually and let the installer do it. The installer would have done a 500Mb partition for the EFI System Partition and that is more than adequate if you are using Grub for a boot loader. The swap partition is only needed for special cases as the Ubuntu installer will use a swap file instead if it doesn’t find a swap partition.

Short term fix, boot Ubuntu ISO on USB and use GParted to expand partition 2 to consume a large amount of partition 3, you could double the space for /

Thats a really odd choice for sizes

/boot/efi be to be about 500MB, 37G is crazy huge, thats 8% of your disk you’ll never use
/ is where all the installs happen , 28G is tiny small
/home is where all the user generated files live, pictures, documents, videos - is 363GB crazy - I don’t know, it depends on what you do with files.

But if your drive craps out, its going to take all the partitions with it, so there really isn’t any advantage of separating out /home and / and its just going to perpetually annoying to have some space in one place and no space in the other.

What you seem to have done is partition your disk for $reasons and now you’re trying to do something that would break those $reasons, probably the right thing to do is rethink what your reasons are and see if you can either fix the sizes to put things where you want them for whatever $reasons are.

You can resize and move around the partitions you have if you’re not running from that drive at the time, a live CD/USB is the easiest way to do that. I would shrink /boot to 500MB and grow / into the space, probably leave /home as it is.

1 Like

Well, that’s the feedback I was looking for…

[1] Do you have a suggested resource for Ubuntu that reviews a most effective setup for the partitions on the boot device? (…the one’s I found online lead me to construct the present mess.) So, for what proven standard setup am I aiming?

[2] What will resizing the partitions with a live USB as suggested do to the data that’s presently in those partitions? (per @Jeremy31 and @wiil )

I presently have Ubuntu running as I’d like it thus far… resetting everything from a new install sounds about as fun as a self-inflicted root canal.

[3] What do I need to do to preserve the current “status” or “setup” with apps/snaps and other things prior to resetting partition sizes?

@ogra , that article is a bit beyond my skill set at present. Thanks for the suggestion.

My query would be why use a 37.3G swap partition, though without knowing your hardware or how you use your system it is impossible to say how useful that might be.
Do you wish to or already use hibernation for the system rather than simply suspend, and how much RAM do you have?
Just like wiil it seems to me that you have a strange partition setup.

Regarding you query about snaps, I can’t help at all as I do not have any on my system.

The present setup results from my own ignorance, lack of experience with this topic, and following the information posted online; possibly that which I could comprehend at the time, or even that which I THOUGHT I comprehended at the time… and implemented wrong.

In any case, what I’ve got isn’t working and needs fixed. See above for present questions. Thanks for taking the time to reply @ajgreeny ! ;-D

Before even considering any more changes, first backup all your important data in case something goes wrong (hopefully not).

One possible solution, which I have not tested, would be to move your snap installs to /home and then create symlinks for them.

I would start there and see how it goes, meaning is everything stable and functioning as expected.

But wait for others to offer advice since there are a few ways to try and resolve the situation.

[2] If you boot with a live CD and use gparted then you should be able to resize the drives without losing any of the content, it should be seemless but with scary warnings. Logically everything you actually care about is on /home, so if you don’t touch that you should be OK

Gparted will do the work of moving files around so the space is all at the end of the drive before shrinking it.

I don’t remember if you can grow a partition into preceding space, but gparted will allow you to move a partition so the space is behind it and it can grow it into following space.

[3] as far as Linux is concerned, as the files aren’t moving off the device, nothing has changed and these actions will be invisible.

GParted seems to be an available add-on Application, and not the partition tool available with Disks or by running setup via USB live… which comes up as available for install at Applications search (for those that follow).

I’ll have a look at that app, see if I can grasp how to run it. Expect some follow-up questions come Monday mid-Morning… lol. (@wiil )

I’ll also look into backing up data in the m2 500Gb system device for each partition before I attempt any of the suggested partition resets. (@rubi1200 ) Hopefully this isn’t beyond my skill set and present comprehension.

Thanks all, enjoy what’s left of your weekend!

There are a lot of guides online where the information is somewhat out of date, or the poster is teaching you how to do things as if you are running a huge datacentre. Linux is a useful playground for learning how to do things that you can apply in huge environments with network addressable storage which makes no sense except as a way to learn, so these examples exist for good reasons.

Beware of guides that are more than 5 years old, or going off track for things there the installer offers you a set of defaults!

You’ve chosen this baptism of fire, but thats OK as long as you’re happy learning and not just frustrated that this road isn’t paved for you!

You have to run Gparted from the Ubuntu ISO on USB as the file system can’t be in use(mounted) and be modified

If it isn’t on your your install media, then get an install with it already on.

Recently I have been using the one from

https://gparted.org/livecd.php

…and how the heck do I do that? (run GParted in some other session where my m2 system drive is not running the present session???) Presently reading through https://gparted.org/livecd.php

For those willing to comment and advise, here is the initial scan in GParted of the environment on the m2 system drive (500Gb)… for p1 through p4:

241208_GParted_initial_scan

[1] what are the purposes of these sections?
(/ vs. /boot/efi and/or SWAP or /home) I think I know / (root) and /home (user data)… the others are a mystery.

[2] To what size partitions will I be aiming for each?

In the meantime, backups commencing… Using the Backups app in Utilities (Applications):

:ballot_box_with_check: /home ; selected all except “Documents”, “Pictures” saved on other devices (symlinked)
:ballot_box_with_check: / (root) ; selected all except /home dir and /root/efi dir each destined for another folder?
:ballot_box_with_check: /root/efi ; selected the /root/efi directory
(not certain if this is the partition in question or how to access that partition without terminal)

I didn’t bother with SWAP… doesn’t sound as if it’s necessary… storage space to be recovered to the / (root) partition (right?), I think @wiil mentioned.
The /boot/efi section sounds as if it can be MUCH smaller… also storage space to be recovered to the / (root) partition… yes?

so GOALS for GParted resizing partitions looks like:
[1] eliminate SWAP (-40Gb)
[2] resize /boot/efi (from 40Gb down to 500mb)
[3] resize / (root from 30Gb to ~100Gb recovering SWAP and /boot/efi storage)

Does that sound like what I should be aiming for?

You are partly correct in your assumptions about the various partitions you have but just far enough away from the full picture that you could possibly cause yourself problem if you’re not careful.

The /home partition does as you suggest contain your data files and folders but is not only for those; it also contains a great deal of your user configurations of how you system and applications work. There are a lot of hidden files and folders in /home that are very important and if you are not careful you could potentially lock yourself out and stop your user logging in.

A swap partition is no longer the default for Ubuntu which uses a swap file in the root / partition so you could choose at installation not to add or use an existing swap partition. The installer will then create an appropriately sized swap file.

The root partition is the main one which contains all the files and folders of the operating system and is definitely not one to mess with unless you know exactly what you’re doing and why you’re doing it!
Nothing there is owned by you so can only be edited or dealt with using root permissions so TAKE GREAT CARE!.

The ESP/EFI partition mounted at /boot/efi is where all the UEFI and boot information needed by the system sits so once again do not mess with that without knowing what you are doing.
Nevertheless 37.3G size for that is ridiculously large; 500M is far more normal and in fact mine is only 210M and holds only a small amount of files, nowhere near that 210M.

The /swap partition is I think similar to what in Windows was called virtual memory, but I might be wrong about that not having used Windows for almost 20 years. It is used in Linux when your hardware RAM is overloaded in order to stop the system beginning a slow down to a crawl.

I hope that helps but if it’s still too uncertain for you ask more questions.

1 Like

and how the heck do I do that?

Gparted live usb means the kernel isn’t running from the disks you are working on

[1]

/ is where everything lives, all files and a lot of things that aren’t really files but behave like files (everything in linux lives in the file system and behaves like a file, you’ll get to that later!)

under / are other directories, /usr/ /bin /var /proc /etc etc etc.

Any directory can also be a mount point, that is where you tell the kernel you want to place another thing that acts like a file/directory. When you insert your USB stick and click on the icon, you create a directory called /media/david/My_VOLUME_NAME and the files from the USB stick appear there exactly as if they are on / itself. This means you can put all your files in a directory called /home, or you can put all your files in a thing called /home which is actually another filesystem.

To add a little further complexity, a directory with files in it can ALSO be a mount point, from the users perspective if you have a directory with files in it and you use it as a mount point then the files in that directory are temporarily masked by the files on the device mounted. That means if you fail to mount /home then your write a file into /home, the next time you mount /home the files you have actually written to the filesystem at / will appear to disappear (believe it or not, this is sometimes useful!)

/boot/efi is a FAT32 filesystem that is used by the computer BIOS during boot, it contains the linux kernel and files that need to be used to bootstrap the system. These files aren’t stored in / because the BIOS doesn’t understand linux filesystems, so the kernel needs to be running before the files in / can be read. Once the kernel is running you don’t really need /boot/efi, but its mounted (placed in the filesystem) at /boot/efi so that updates can install new kernels etc.

SWAP is used for virtual memory. When the system memory is getting low, the kernel can take things stored in memory but infrequently used and put them on disk. That means that two things are possible. Firstly you can open more applications, or tabs on your browser, or bigger spreadsheets or longer video clips than you would be able to with the installed system memory. Secondly you can use the memory to store things on that live on the disk to reading/writing them is faster. Programmers are great and all, but they suck at knowing what is really important for the end user. The kernel know that (for example) you don’t really need to have all the potential fonts in memory because it can see you’re not using them, so out to disk they go. The programmer might think that your spreadsheet is something that should live on persistent storage so they put it there, but the kernel can see its a file you keep opening and closing, so keeping a copy in memory makes your workflow much faster, and it can occasionally write it back to disk in case the system crashes. This is because reading and wring to disk is about 1000 times slower than writing to memory!

Generally swap is done by the system creating a file on / somewhere, (in my system its a 2GB file at /swapfile) but in your system you have specified it as a whole 37GB partition. Using a partition is the old way of doing things but it won’t cause you any harm except for the loss of space. General advice is somewhere between Sqrt(mem) and mem*2 is good, but i’m currently running far less than that because I’m nowhere near needing it anyhow on my 32GB system.

1 Like

…Presently reading @ajgreeny , @wiil and the GParted link that @wiil suggested earlier. It may take me a day or two to digest the information.

So, as for the /boot/efi directory, that’s a mount point where a device, a partition in this case, is mounted… yes? …as Linux organizes everything with the filesystem, including the devices (physical storage disks and media). Therefore backing up data from /root/efi DOES backup the nvme0n1p3 partition mounted at /boot/efi ???

Does it sound like I’m absorbing this at all… lol.

As for physical system memory, when I built this desktop I loaded it up with as much memory as the motherboard could take, 4x 8Gb for 32Gb total. I do some photo and video work, as well as play some games now and then, it serves it’s purpose.

I wouldn’t do anything with SWAP just yet.

When you’re ready have a read of

https://help.ubuntu.com/community/SwapFaq

If you want hibernation then you need a big swap space and it doesn’t really matter if its a big file or a partition, both use up disk space.

Removing the SWAP partition may reorder your file systems, I’m pretty sure that if you have /sda1 sda2 sda3 and you delete sda2 then sda3 becomes known as sda2. That might be a problem if your fstab or bootloader config refers to disks by hardware location rather disks by UUID.

If that worries you, then post your /etc/fstab and /boot/efi/EFI/ubuntu/grub.cfg files here

1 Like

Yes… ish

If you do a file copy ( ‘cp /boot /media/david/mybackupdrive’) then the copy will copy all the files BUT you can ask cp to only copy files that are actually on the filesystem, so ‘cp -x /boot /media/david/mybackupdrive’ will copy only the files on the block device that provides /[boot] and NOT the ones on the block device containing /boot/efi. You can see how this might be useful for backing up ‘/’ where you have to write it to a filesystem that itself is in ‘/’. So, be careful with the assumption!

My advice for creating a backup would be to use a liveUSB version of clonezilla https://clonezilla.org/ to create a full disk backup of all partitions.