Page 1 of 3 123 LastLast
Results 1 to 10 of 25

Thread: Swapping leading to frequent hanging

  1. #1
    Join Date
    May 2013
    Location
    Kerala, India
    Beans
    31
    Distro
    Ubuntu Studio 13.10 Saucy Salamander

    Exclamation Swapping leading to frequent hanging

    I have my ubuntu installation alongside Windows. Initially it was simply a try-out installation to learn how the OS works, but later on I started loving the system more and migrated my full-time works to ubuntu.

    During the switch, I realized that my installation wasn't capable of full-time use since it was installed without separate mount points for root and home directories. I used gParted to create separate mount points for my root and home directories and also increased the space allocated to the root, home directories as well as the swap partition.

    Initially, I had a 2GB swap and then I increased it to 4GB. As of now, gParted shows me 4GB of swap space; But System Monitor shows me only 2GB of swap space. I have no idea what has caused this problem.

    Now, I have 8GB of RAM, but can't afford 16GB of swap (considering the optimum swap allocation is 2x RAM).

    After the re-allocation of memory, my system swaps out in a period of 2 hours and then hangs up. I'll have to do a emergency restart to start over again.

    I have no idea why this is happening and what is causing this problem. My inference is it is because of the swapping out of the memory. But the best part is my RAM usage is always around 2-2.5GB/7.7GB when the swap memory is filled up. I looked up solutions for cleaning up the swap memory, but was in vain.

    Does anyone here have experienced a similar problem. Any help with this regard would be greatly appreciated! This problem has been tormenting me for months now.

  2. #2
    Join Date
    Feb 2007
    Location
    West Hills CA
    Beans
    7,910
    Distro
    Ubuntu 12.10 Quantal Quetzal

    Re: Swapping leading to frequent hanging

    Open a terminal and post the output of:

    Code:
    uname -a
    free
    Sounds like a 32-bit problem. Did you load the 32-bit or 64-bit version?

    1xRAM for swap size is needed if you want to hibernate your system. Hibernate takes the RAM footprint and copies it to the hard drive so when you wake up the entire contents of RAM gets reloaded. Sleep or suspend keeps power running to the RAM so that it wakes in 3 to 8 seconds. This works OK, unless you run out of battery power or if there is a power glitch, so hybrid mode was created. Keep in RAM and dump to hard disk as a precaution. If your swap is too small then hibernate won't work or it will lock up. The fact that your RAM doesn't exceed 2.5GB of use is consistent with a 32-bit installation.
    -------------------------------------
    Oooh Shiny: PopularPages

    Unumquodque potest reparantur. Patientia sit virtus.

  3. #3
    Join Date
    May 2013
    Location
    Kerala, India
    Beans
    31
    Distro
    Ubuntu Studio 13.10 Saucy Salamander

    Re: Swapping leading to frequent hanging

    Thank you for the reply tgalati4.

    Here's the output you requested :
    Code:
    shine@divine-lap:~$ uname -a
    Linux divine-lap 3.11.0-15-generic #25-Ubuntu SMP Thu Jan 30 17:22:01 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux
    shine@divine-lap:~$ free
                 total       used       free     shared    buffers     cached
    Mem:       8040848    5446116    2594732          0     167076    3595468
    -/+ buffers/cache:    1683572    6357276
    Swap:      2096124          0    2096124
    This is just after a restart, so, swapping hasn't started out yet.

    I have a 64-bit system. I've had my system working properly initially with the underrated configurations. The problems arouse when I made changes to the directories(partitions) on my hard-drive.

    I'm well aware of the hibernate, sleep, suspend and hybrid sleep options. But I don't use any of these. The systems sleeps occasionally when I leave my desk for other work. Otherwise, I don't need any of these options. I stated the RAM usage to reveal the fact that the swapping was not occurring due to insufficient RAM. The RAM is not always consistent at 2.5GB. It varies between 2-2.5GB when the freeze of swap at 2GB occurs.

    But according to gParted, my partitions shows 4GB of swap area. But still, my system fills up at 2GB and freezes at that point.
    Last edited by divine shine; February 5th, 2014 at 10:10 PM. Reason: clarity of information

  4. #4
    Join Date
    Nov 2011
    Beans
    1,271
    Distro
    Ubuntu Development Release

    Re: Swapping leading to frequent hanging

    You said the system "swaps out" after 2 hours. What, exactly, happens? Does the swap partition suddenly fill and the system stop? Or, does swap grow steadily?

    It's curious because swap use should be minimal, or nonexistent, until memory use exceeds physical ram. Then, something will temporarily be written out to swap. When RAM use drops down again, swap use will end.

    The 5+ gigs of RAM used immediately after a reboot draws my attention. It's five times what I see. Are you autostarting anything unusual?

    What does System Monitor say are the most memory-hungry processes after a reboot?

  5. #5
    Join Date
    Apr 2011
    Location
    Mystletainn Kick!
    Beans
    4,146
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: Swapping leading to frequent hanging

    During the switch, I realized that my installation wasn't capable of full-time use since it was installed without separate mount points for root and home directories
    Having a single partition won't affect your ability to use Ubuntu.

    That aside, it's seems quite troubling that your swapping as much as you are.
    Did you increase swappiness or something?
    +1 to buzzingrobot's question of what are you starting up at launch?
    And what apps do you run that eat so much?
    Splat Double Splat Triple Splat
    Earn Your Keep
    Don't mind me, I'm only passing through.
    Once in a blue moon, I'm actually helpful
    .

  6. #6
    Join Date
    May 2013
    Location
    Kerala, India
    Beans
    31
    Distro
    Ubuntu Studio 13.10 Saucy Salamander

    Re: Swapping leading to frequent hanging

    Quote Originally Posted by buzzingrobot View Post
    You said the system "swaps out" after 2 hours. What, exactly, happens? Does the swap partition suddenly fill and the system stop? Or, does swap grow steadily?
    No. The swap grows steadily over time. I don't exactly know when it starts swapping, but the system freezes approximately 2 hours after boot.

    Quote Originally Posted by buzzingrobot View Post
    It's curious because swap use should be minimal, or nonexistent, until memory use exceeds physical ram. Then, something will temporarily be written out to swap. When RAM use drops down again, swap use will end.
    This was my idea of swap too. But now, my idea is shaken. swap simply fills up with loads of space free on my RAM.

    Quote Originally Posted by buzzingrobot View Post
    The 5+ gigs of RAM used immediately after a reboot draws my attention. It's five times what I see.
    It wasn't exactly 'immediately' after reboot. It was like around 15minutes or so after boot.

    Here's the output of 'free' immediately after reboot.

    Code:
    shine@divine-lap:~$ free
                 total       used       free     shared    buffers     cached
    Mem:       8040848    1515896    6524952          0     117324     662820
    -/+ buffers/cache:     735752    7305096
    Swap:      2096124          0    2096124
    Quote Originally Posted by buzzingrobot View Post
    Are you autostarting anything unusual?

    What does System Monitor say are the most memory-hungry processes after a reboot?
    I don't have anything 'unusal' that autostarts. I've got GNOME-Shell, dropbox and variety with maximum memory eat-up immediately after reboot.
    This is how I saw my 'processes' tab, in descending order of Memory Used, in my System Monitor right after reboot :
    GNOME-shell : 89.1MiB
    dropbox : 51.0MiB
    variety : 42.1MiB
    evolution-calendar-factory : 39.0MiB
    ubuntuone-syncdaemon : 32.2MiB

    I don't think there's anything unusual in any of the above processes either.

    Quote Originally Posted by deadflowr View Post
    Having a single partition won't affect your ability to use Ubuntu.
    I know. But the initial configuration for my system was a 10GB on the whole - for both the home and root partitions. Initially that was more than enough since I didn't use Ubuntu much. But when I started using Ubuntu, my home directory filled up very fast. That is when I expanded the memory allocated and created proper partitions for each of the directories.

    Quote Originally Posted by deadflowr View Post
    it's seems quite troubling that your swapping as much as you are.
    Did you increase swappiness or something?
    Yes, I did. When I increased the space allocated for the directories. I did increase my swap from 2GB to 4GB. But the change hasn't been yet reflected on my System Monitor. Though gParted shows 4GB of swap area allocated, my System Monitor still shows me only 2GB and I think that is what is creating this problem.

    Thank you for your replies buzzingrobot and deadflowr. Appreciate the help.

  7. #7
    Join Date
    Nov 2011
    Beans
    1,271
    Distro
    Ubuntu Development Release

    Re: Swapping leading to frequent hanging

    Swap does work the way you think. If you show swap usage steadily increasing, *something* is using it. You should see also your RAM use pretty well maxed out at that time. Or the system, for some reason, is measuring the wrong thing.

    When you said you created new partitions for root and home, did you edit /etc/fstab to reflect those changes? (Just to be sure, when you said you used Gparted to create new "mount points", you created new *partitions* for each? Fstab needs to reflect those changes.)

  8. #8
    Join Date
    Nov 2011
    Location
    /dev/root
    Beans
    7,160

    Re: Swapping leading to frequent hanging

    I suggest that you show us the structure of your swapping. Please post the output of each of the following commands

    Code:
    swapon -s
    grep swap /etc/fstab
    sudo blkid|grep swap
    cat /proc/sys/vm/swappiness
    sudo parted -l
    See also this link https://help.ubuntu.com/community/SwapFaq

  9. #9
    Join Date
    May 2013
    Location
    Kerala, India
    Beans
    31
    Distro
    Ubuntu Studio 13.10 Saucy Salamander

    Re: Swapping leading to frequent hanging

    Quote Originally Posted by buzzingrobot View Post
    Swap does work the way you think. If you show swap usage steadily increasing, *something* is using it. You should see also your RAM use pretty well maxed out at that time. Or the system, for some reason, is measuring the wrong thing.
    Yes, I know. That is exactly why I mentioned that I have an 8GB RAM and when the system freezes, the RAM usage is around 2-2.5GB. I don't do much RAM/memory intensive work. Mostly, it's just surfing the web. Occasionally, I use a few simulators when I'm developing apps. But even during that time, the RAM usage never crosses 4.5GB. Another interesting thing I noticed was that the 'free' command does not reflect the amount that is reflected by the System Monitor. The 'free' command showed 2.75GB of usage when the System Monitor was on 1.2GB. Is that supposed to be normal?

    Quote Originally Posted by buzzingrobot View Post
    When you said you created new partitions for root and home, did you edit /etc/fstab to reflect those changes? (Just to be sure, when you said you used Gparted to create new "mount points", you created new *partitions* for each? Fstab needs to reflect those changes.)
    Yes. I edited the /etc/fstab to reflect the /home and /root directory changes. But I don't think I had to change the swap area's entry (at least I don't remember doing it). I just moved the partitions using gParted to create some unallocated space after swap and extended the swap area. gParted does show 4GB of linux-swap area, but System Monitor shows only 2GB. That probably might be the problem too. Something is not measuring right!

  10. #10
    Join Date
    May 2013
    Location
    Kerala, India
    Beans
    31
    Distro
    Ubuntu Studio 13.10 Saucy Salamander

    Re: Swapping leading to frequent hanging

    Quote Originally Posted by sudodus View Post
    I suggest that you show us the structure of your swapping. Please post the output of each of the following commands

    Code:
    swapon -s
    grep swap /etc/fstab
    sudo blkid|grep swap
    cat /proc/sys/vm/swappiness
    sudo parted -l
    Here's the output of the above commands :

    Code:
    shine@divine-lap:~$ swapon -s
    Filename                Type        Size    Used    Priority
    /dev/sda9                               partition    2096124    0    -1
    
    shine@divine-lap:~$ grep swap /etc/fstab
    # swap was on /dev/sda9 during installation
    UUID=94d2a8ce-ec9c-4123-9681-a5ad81f7eff0 none            swap    sw              0       0
    
    shine@divine-lap:~$ sudo blkid|grep swap
    [sudo] password for shine: 
    /dev/sda9: UUID="94d2a8ce-ec9c-4123-9681-a5ad81f7eff0" TYPE="swap" 
    
    shine@divine-lap:~$ cat /proc/sys/vm/swappiness
    10
    
    shine@divine-lap:~$ sudo parted -l
    Model: ATA ST500LT012-9WS14 (scsi)
    Disk /dev/sda: 500GB
    Sector size (logical/physical): 512B/4096B
    Partition Table: gpt
    
    Number  Start   End     Size    File system     Name                          Flags
     1      1049kB  525MB   524MB   fat32           EFI system partition          boot
     2      525MB   567MB   41.9MB  fat32           Basic data partition          hidden
     3      567MB   701MB   134MB                   Microsoft reserved partition  msftres
     4      701MB   1226MB  524MB   ntfs            Basic data partition          hidden, diag
     5      1226MB  93.7GB  92.4GB  ntfs            Basic data partition          msftdata
     6      93.7GB  452GB   359GB   ntfs            Basic data partition          msftdata
     7      452GB   468GB   16.1GB  ext4                                          msftdata
     8      468GB   485GB   16.1GB  ext4                                          msftdata
     9      485GB   489GB   4295MB  linux-swap(v1)
    10      489GB   500GB   11.0GB  ntfs            Microsoft recovery partition  hidden, diag
    
    
    Error: The backup GPT table is corrupt, but the primary appears OK, so that will
    be used.
    OK/Cancel? OK                                                             
    Warning: Not all of the space available to /dev/sdb appears to be used, you can fix the GPT to use all of the space (an extra 45756080 blocks) or
    continue with the current setting? 
    Fix/Ignore? Ignore                                                        
    Model: ATA LITEONIT LMT-32L (scsi) //This is my SSD drive I have on my system. Haven't used it though.
    Disk /dev/sdb: 32.0GB
    Sector size (logical/physical): 512B/512B
    Partition Table: gpt
    
    Number  Start   End     Size    File system  Name                  Flags
     1      1049kB  8589MB  8588MB               Basic data partition
    Last edited by divine shine; February 6th, 2014 at 02:15 PM.

Page 1 of 3 123 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
  •