Physical Location of a Swap Partition



How many gb of ram do you have ?

It is my understanding that swap is only used when particularly heavy use of ram is made....maybe by video editing etc and the ram runs a bit short, so the swap partition is used as a temporary backup space


""Swap space in Linux is used when the amount of physical memory (RAM) is full. If the system needs more memory resources and the RAM is full, inactive pages in memory are moved to the swap space. While swap space can help machines with a small amount of RAM, it should not be considered a replacement for more RAM.""

So....what I am saying is..if you have only lightish use...browsing, facebook, linux.org, etc etc.....then you probably do not need swap at all.

In my own situation I have 16 gb of ddr4 ram and do not use anything 'heavy' at all (on this pc)....therefore no swap partition.

If it tuns out that you do need it....at the beginning of the drive is usually considered better...because it will be accessed faster than if it were at the end. If you have the choice and have the necessary ability to do it....more RAM is always better, because it is significantly faster.
 
I only put it on this laptop because of the damn NVIDIA GPU. I haven't been using swap any longer but I had issues running this laptop without it. I had so many issues because of the NVIDIA and now that this system is up and running with the swap in place I'm afraid to get rid of it! On my other laptop (sans NVIDIA) I have 8 GB RAM and have 6 distros installed and it runs flawlessly without swap.
 
Is this lappie #1, #2 or c. none of the above Jeffrey :D

Are we talking 256GB SSD with 1TB HDD, 128GB SSD with 1TB HDD or other?

How many Distros on so far, and are there more to follow?

Spill your guts, and subject to that, I might actually recommend placing it at the end of one of the drives.

Wiz
 
Greetings! Ok, laptop #2 (no NVIDIA) is the laptop that I am multibooting on. It's 128 gb SSD w/ 1 TB HDD, 8 GB RAM. It currently has 6 Ubuntu/Debian based distros on it and is humming along! I may add a few more but haven't decided.

On laptop #1 (w/ NVIDIA) after fighting with a few different options (and with difficulty getting anything running well) I ended up installing Manjaro Cinnamon with the open source driver and using 4.19 kernel. I put a 16 GB swap partition on it because when I tried to get Mint 19 running w/o a swap the damn NVIDIA processor would start whirling and everything would lock up (remember me complaining about a loud noise that I thought was a bad SSD?)

As for the location, I was wondering if the end of the SSD would be the best place as well. EVENTUALLY I want to load a few more distros on this, but a wise wizard once suggested that I spend a month or so getting familiar and comfortable with ONE before adding more! :D
 
Does the physical location of the swap partition on a drive matter?
Weren't we just talking about this (here)? It's kind of a good idea not to open new threads with the same issues. :confused::eek::D


If it tuns out that you do need it....at the beginning of the drive is usually considered better...because it will be accessed faster than if it were at the end.
In the other thread, I took the opposite point of view. IMO, if you have plenty of RAM and you need swap... speed is not your concern, it's survival. It's time to save your work and reboot. If you also run out of swap space, your computer will crash... not fun when lots of work is suddenly lost, or if an important database gets corrupted. (Have we talked about the importance of backups? :eek::D)

With 16 GB of RAM, you really should not need swap at all. If Manjaro or some distro seems to be unhappy without any swap, then just a small amount will probably satisfy it (2 GB or 4 GB). You may want to observe whether your system is, in fact, using any swap during operation. The top and htop commands can show you this in real time. Check it periodically. If you are, in fact, using swap.... I'd look long and hard at your RAM chips as one may be defective or failing.

Something you might want to do is to run memtest to examine your RAM and see if there are any problems indicated. This test is available when you boot up on the grub screen. Be aware that it takes a long, long time to complete as it makes many passes with many tests. I would start the test in the evening and check it in the morning. If any errors come up, remove a RAM chip and test again (assuming you have two chips of 8 GB each). You already know from your other laptop that you can do just fine with only 8 GB total anyway.

Cheers
 
we don't let Wizard boil people in oil anymore!

Sez you.

We could delete the other Thread, either of us, Stan. There is little at the other that is not being covered in more detail here.

Jeffrey, can you post us a screenshot of /dev/sda from that unit? From GParted, that is..

I am still considering some content for this thread.

And to clarify, is that Manjaro Cinnamon we are looking at and talking about in your Posts #5 and #6?

Cheers

Wiz
 
With 16 GB of RAM, you really should not need swap at all. If Manjaro or some distro seems to be unhappy without any swap, then just a small amount will probably satisfy it (2 GB or 4 GB). You may want to observe whether your system is, in fact, using any swap during operation. The top and htop commands can show you this in real time. Check it periodically. If you are, in fact, using swap.... I'd look long and hard at your RAM chips as one may be defective or failing.

I can't say with certainty that the swap was the issue. My other system is 8 GB of RAM and I am running well without swap. I am running htop now and I'm not using any swap and actually minimal amounts of RAM. This laptop has me baffled and unless there is a hardware issue that I do not know about I can only assume it's the GPU that is causing the problems since it is the only thing that is different between the machines.
 
Thanks for that screenshot, Jeffrey :) (Look out, he's got a hold of Brian's thumbs up, he'll be lethal now)

There are two scenarios (scenaria, but who's being pedantic?) I can offer that might fit your bill:

SCENARIO 1 - SWAP TO END OF SSD AND RESIZE

In GParted (this can be done in MJRO Cinnamon's session, as it does not affect your root partition running)

  1. Right-click swap partition choose swapoff
  2. When off, right-click swap partition and choose resize, popup window will appear with 3 fields
  3. Click in New Size (MiB), change to 4096 MiB (4 Gig), press Tab you will be taken to 3rd field and figures will change
  4. In 3rd field Free Space Following (MiB), change to 0 (zero), figures will change
  5. Figures in Free Space Preceding (MiB) that is, 1st field, should now be substantial
  6. Click Resize/Move icon and then Apply All Changes curved arrow near top
  7. Reboot on completion, this will also activate Swap again (Swapoff only lasts for the current session)
Evaluate performance, over time.


SCENARIO 2 - SWAP TO END OF HDD /dev/sda

This is simple enough with your current environment on this laptop, a little more complex on the other that is more populated with Linuxes.

In GParted
  1. On /dev/sda (hard drive), below the Timeshift partition, right-click unallocated space and choose New
  2. In Free Space Preceding, set to 0 (zero) if not already so, then Tab
  3. In New Size (MiB) type 4096, then Tab, the Free Space Following should adjust its figures by a large amount
  4. Leave Create As as default, which should be Primary
  5. Naming the partition is optional, as is labelling
  6. For File System, choose "linux-swap"
  7. Add and Apply Changes
Still in GParted and once you have your new Swap Partition on the HDD, you can go to /dev/sdb and Delete the redundant Swap
  1. Right-click the old Swap and choose Swapoff
  2. Right-click and Delete, then Apply Changes. The figures for unallocated space will incease by about 16 GiB
Still in GParted
  1. Return to /dev/sda and right-click your new Swap Partition, and choose Information, in the popup window there will be a UUID for the Swap, it will be shorter than for other partitions
  2. Carefully drag over that UUID number to highlight it (or write it down, it's not long, but be accurate :)) and right-click choose Copy
  3. You can exit GParted or leave it running
Open a Terminal
  1. type in and enter
    Code:
    sudo nano /etc/fstab
  2. There will be a line likely at the very bottom which refers to your old swap and has the UUID for it
  3. Carefully delete the old UUID and leave the insertion point where it is once done
  4. Press Ctrl-Shift-v and the new UUID will be inserted
  5. Exit nano using the ^x (Ctrl-x), Y for yes, and enter once file name is displayed, as usual.
  6. Update your Grub files with (Manjaro uses update-grub as do Debian-based Distros)
    Code:
    sudo update-grub #which is a stub for a longer command
    
    #or the longer command
    
    sudo grub-mkconfig -o /boot/grub/grub.cfg
  7. On completion, reboot, and report any errors.

The longer command can be useful to the multi-multi-booter, as update-grub is not available in many of the Linux Families. The syntax can vary a little, but that can be discussed in a Thread on Grub.

The Scenario 2 results could also be achieved using a command called "mkswap". The above is simply my preference. There is always more than one way to skin a cat, lol.

In your multi-booting laptop, it can also be the case that we use a method I have used successfully, to force-set a UUID to a new Swap that matches the old, and so you need not have to edit the /etc/fstab entries for each and every Distro. Handy for me (if I used Swap, which I don't) on the Toshiba with over 40 Distros. :)

I would advocate Scenario 2, and I am mindful of what Brian has said earlier

...at the beginning of the drive is usually considered better...because it will be accessed faster than if it were at the end

I will address that in a subsequent Post.

Cheers

Wizard
 
Code:
sudo update-grub #which is a stub for a longer command

#or the longer command

sudo grub-mkconfig -o /boot/grub/grub.cfg

- stupid question (it's 3 AM and I'm exhausted tonight) do I enter the above code as is or do I need to modify it?
 
Back out and do it fresh Mate

Also, I note the disparity between the space consumed in your Timeshift partition and the space used in MJRO Cinnamon. So take a full snapshot with Timeshift before engaging in any operations.

Wizard

BTW that means catch some ZZZZ'es :mad:
 
Question - since it looks like I am not even using the swap could I simply do a swapoff and delete the swap partition? As I mentioned, I am not sure if the hang up I had with the previous install was related to the lack of swap. If you think the system should run well without it, I'd be happy to just delete it.
 

Staff online

Members online


Latest posts

Top