Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Definitely a newb at linux, pretty much just here for gaming, python, and blender.
I have 128 GB of RAM and didn't see the point in having a swap, so I deleted it with Gparted. Booted up with my live usb in recovery mode, and from there had it boot normally. Haven't yet tried rebooting without the live usb.
1. What should I have read before I did this?
2. What terminal commands should I enter to provide more information to you?
Hopefully not too detailed - note those file references (e.g. fstab) are to the on-disk system, not the liveUSB equivalents. Are you able to provide listings of them ?.
Quote:
Originally Posted by kotte
I have 128 GB of RAM and didn't see the point in having a swap, so I deleted it ...
Obligatory reference to an excellent rebuff from one of the kernel devs here.
As far as I know Ubuntu creates a swap file by default now not a partition anymore unless you manually created the partitions for the installation. Can you delete a swap file from gparted?
Ubuntu has been using a swap file for several years rather than a swap partition. So is Ubuntu the only OS installed? Did you create the swap partition yourself? Was it created/used for another Linux OS? I'd follow the suggestion above to comment out or delete the entry for swap in the /etc/fstab file. The expected entry in the fstab file for Ubuntu would start with; /swapfile
Hello all, and thank you for the welcome. Especially beachboy2 for that solution.
I first read the link syg00 provided to understand why I should want a swap. I decided to make a similarly sized swap as I first made to see if it would work, at least to start. I did so with Gparted.
Looking at /etc/fstab and reading that stackexchange explanation I realized I needed to get the UUID for the new swap partition, and replace the old UUID with the new one in /etc/fstab. I did so by running:
ls -l /dev/disk/by-uuid/
I identified each partition by name and UUID by comparing the /dev/[filename] of each partition in /etc/fstab to the partition names in GParted, then noting the UUID of each. Then I replaced the old with the new as above.
Following along in the stackexchange link, I made sure that the swap partition's UUID existed, was updated, was correctly formatted as per the link, and was not commented out in /etc/initramfs-tools/conf.d/resume.
Then I turned the swap on in gparted, verified it was running in the system monitor, and ran:
update-initramfs -u -k all
update-grub
The swap works, it boots in less than 10 seconds, so all's good!
I may resize the swap partition later to between 2 and 4 gigabytes, and resize my ext4 partition to use the freed space, but first I want to make sure nothing bad will happen, back up my files, and make a restore point (which I should've done before).
Next time make life easy(er) on yourself by using the same UUID on the regenerated swap - see the manpage. Simply swapoff, delete the partition, remake it at the "end" of the disk so you only need to do it once, and remake it with the UUID. Swapon, all done.
KISS.
Next time make life easy(er) on yourself by using the same UUID on the regenerated swap - see the manpage. Simply swapoff, delete the partition, remake it at the "end" of the disk so you only need to do it once, and remake it with the UUID. Swapon, all done.
The manpage of which program?
Also if I were to shrink the swap to ~ 2 GiB, and grow the / ext4 partition to reclaim the unused space leftover by the smaller swap partition, I'd have to do the latter in a live USB, correct?
All of this can be done whilst the system is running, but I wouldn't recommend it for a self confessed "newb at linux". LiveUSB is always a good option. Also note my sigline - especially when messing with partitions.
Your problem could have been avoided entirely if you (or whoever installed Ubuntu) had not decided to create a swap partition when the default behavior with newer Ubuntu releases is to use a swap file. Curious as to why you did that. On the other hand, this was a good learning experience.
Your problem could have been avoided entirely if you (or whoever installed Ubuntu) had not decided to create a swap partition when the default behavior with newer Ubuntu releases is to use a swap file.
How so ?.
Anyone inclined to delete a swap partition to reclaim what they see as "wasted space" would likely be just as motivated to delete a swap file.
Similar result.
True enough, a good reason to investigate the consequences of an action before making a change. The OP did ask about consequences in the initial post but not until after the swap was deleted. Would have been better off accepting the defaults until after investigating which is the point I was making, investigate before you act.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.