Page 1 of 2 12 LastLast
Results 1 to 10 of 11

Thread: Verify that swap is working

  1. #1
    Join Date
    Apr 2014
    Beans
    12

    Question Verify that swap is working

    I've been running this laptop soundly for several months. I never noticed any activity on the swap partition in System Monitor's resource's tab, htop, etc... I have 8 gigs of memory, so I just kind of figured the swap was never needed/ used, or if it was I just never noticed. Now, I'm beginning to believe that it doesn't work at all. The swap is set to on.

    I searched online. Does anyone have any suggestions?
    All help is greatly appriciated.


    $ sudo tune2fs -l /dev/sda6

    tune2fs 1.42.9 (4-Feb-2014)
    tune2fs: Bad magic number in super-block while trying to open /dev/sda6
    Couldn't find valid filesystem superblock.

    Stumped,
    Jason

  2. #2
    Join Date
    Apr 2012
    Beans
    7,256

    Re: I don't believe my swap is working. Please help...

    Are you showing us the tune2fs output for your swap partition? afaik swap doesn't use an ext filesystem, so I don't think that's significant - what is the output of

    Code:
    swapon -s
    
    free

  3. #3
    Join Date
    Apr 2007
    Beans
    3,114
    Distro
    Ubuntu

    Re: Verify that swap is working

    It appears you see your swap in your monitoring tools. I guess it will be OK. With 8 GB of RAM, one rarely if ever uses swap during normal desktop usage.

  4. #4
    Join Date
    Apr 2014
    Beans
    12

    Question Verify that swap is working/Please give me the results of tune2fs on swap partition.

    I done both of these before I posted:
    swapon -s

    free

    I still get the message: tune2fs: Bad magic number in super-block while trying to open /dev/sda6

    Couldn't find valid filesystem superblock.

    Do others get this message when using the tune2fs tool to investigate the partition that swap is on? I'm curious.

    sudo tune2fs -l /dev/sda6

    Thanks,
    Jason

  5. #5
    Join Date
    Jun 2010
    Location
    London, England
    Beans
    Hidden!
    Distro
    Ubuntu Development Release

    Re: Verify that swap is working

    I am using 14.04 on a machine with 1 GB of RAM and at the moment it is using 356 MB of swap space. Why would you expect swap to be used with 8 GB of RAM? You could install system-load-indicator. It is in the software centre. That will give you, among other things, a memory usage readout in real time. Next, you would need to find some really memory intensive process that will use up most of your memory and then start to load other applications and see what happens.

    Regards.
    It is a machine. It is more stupid than we are. It will not stop us from doing stupid things.
    Ubuntu user #33,200. Linux user #530,530


  6. #6
    Join Date
    Jun 2006
    Location
    UK
    Beans
    Hidden!
    Distro
    Ubuntu 22.04 Jammy Jellyfish

    Re: Verify that swap is working/Please give me the results of tune2fs on swap partiti

    Quote Originally Posted by Jason_Minns View Post
    Do others get this message when using the tune2fs tool to investigate the partition that swap is on? I'm curious.
    From man tune2fs:

    tune2fs - adjust tunable filesystem parameters on ext2/ext3/ext4 filesystems
    (My bold.) A swap partition doesn't have a ext2/ext3/ext4 filesystem. Using tune2fs to investigate a swap partition is a bit like using a cheese grater to fry onions. It's the wrong tool for the wrong job. But to satisfy your curiosity (my swap is on sda5):

    Code:
    $ sudo tune2fs -l /dev/sda5
    tune2fs 1.42.9 (4-Feb-2014)
    tune2fs: Bad magic number in super-block while trying to open /dev/sda5
    Couldn't find valid filesystem superblock.
    The same output as you, but it doesn't worry me because that output is meaningless. Wrong tool; wrong job.

    I think you've been sufficiently answered by others - there is nothing wrong in what you are seeing.
    Ubuntu 20.04 Desktop Guide - Ubuntu 22.04 Desktop Guide - Forum Guide to BBCode - Using BBCode code tags

    Member: Not Canonical Team

    If you need help with your forum account, such as SSO login issues, username changes, etc, the correct place to contact an admin is here. Please do not PM me about these matters unless you have been asked to - unsolicited PMs concerning forum accounts will be ignored.

  7. #7
    Join Date
    Apr 2014
    Beans
    12

    Question Re: Verify that swap is working/ then Why 1.5 to 2x RAM?

    Good to know. Which bring me to my next question: If you next to never use swap, why would they recomend that the swap partition size should be 1.5 to 2 times the size of your ram? That doesn't make much sense to me.

    Thanks,
    Jason

  8. #8
    Join Date
    Apr 2014
    Beans
    Hidden!
    Distro
    Ubuntu Development Release

    Re: Verify that swap is working

    I've 4GB RAM and the only time my machine has to ever use SWAP is whenever I try to run VM with granting it 40% of my installed RAM, and even then it is used below 50MB.

    General thumb rule is keeping it in equal amount as your RAM or 1.5xRAM, that is if your RAM is really low. It is used for things like Hibernation & suspend (I don't use or advise it anyway) and in some really really off chance, there is some malfunction with application which keeps opening windows till your RAM runs out of space and then it starts to access your SWAP. When it hits SWAP area, it gets slow and easy to damage control, because by nature; SWAP is quite slow, especially compared to RAM. The latter has actually happened with me but I hit hardreboot before it reached SWAP, so no real worries there either.

    However, IMO, when you've more than 4GB RAM and don't plan to hibernate or suspend, you are actually quite free to reduce that SWAP size to around 1 or 2GB or something. It doesn't really hurt in these days of TB HD's and GPT.

    The easiest way to check whether SWAP is mounted or not is to have gparted on your system, you can simply open it and see if there is ''key'' icon in front of SWAP partition. It being there indicates that; that particular partition is currently mounted. Of course, you can check other partitions also, gparted is quite handy.
    Last edited by LastDino; May 24th, 2014 at 08:34 PM.

  9. #9
    Join Date
    Jul 2010
    Location
    ozarks, Arkansas, USA
    Beans
    14,199
    Distro
    Xubuntu 22.04 Jammy Jellyfish

    Re: Verify that swap is working

    Jason_Minns; Well, consider

    Ram is the memory usage area on your computer, if you are doing some heavy duty stuff, and run out of ram, recon what is going to happen ? =>
    Crash big time ! Not a good thing at all as all the system files are open and the crash leaves them in an inconsistent state. Swap gives the system someplace to move less needed stuff out of ram, and if you do run short on ram space, a place to go to . Particularly so in hibernation and suspend of the operating system.

    Depending on what you are doing, or might do in the future, is how much hard disk space (swap partition and/or a "swap file") one allocates to that use.

    hope this helps
    THE current(cy) in Documentation:
    https://help.ubuntu.com/community/PopularPages

    Happy ubuntu'n !

  10. #10
    Join Date
    Jun 2006
    Location
    UK
    Beans
    Hidden!
    Distro
    Ubuntu 22.04 Jammy Jellyfish

    Re: Verify that swap is working/ then Why 1.5 to 2x RAM?

    Quote Originally Posted by Jason_Minns View Post
    If you next to never use swap, why would they recomend that the swap partition size should be 1.5 to 2 times the size of your ram?
    That recommendation is from years ago when RAM was measured in MB rather than GB, and running out of RAM was more likely. As mentioned, if you wish to hibernate your system, it's best to set your swap to be the same size as your RAM. Other than that, with 8GB RAM you may rarely see any swap used.
    Ubuntu 20.04 Desktop Guide - Ubuntu 22.04 Desktop Guide - Forum Guide to BBCode - Using BBCode code tags

    Member: Not Canonical Team

    If you need help with your forum account, such as SSO login issues, username changes, etc, the correct place to contact an admin is here. Please do not PM me about these matters unless you have been asked to - unsolicited PMs concerning forum accounts will be ignored.

Page 1 of 2 12 LastLast

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •