Find the answer to your Linux question:
Page 1 of 2 1 2 LastLast
Results 1 to 10 of 13
Hello, I'm running Slackware 12. Kernel 2.6.26-SMP (Which has saved me a lot of setup headaches) on an HP Pavilian dv9000. Intel DualCore 2GB RAM. I recently was playing around ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined! wahcordian's Avatar
    Join Date
    Jul 2008
    Posts
    18

    Question Swap isn't working, what gives?


    Hello, I'm running Slackware 12. Kernel 2.6.26-SMP (Which has saved me a lot of setup headaches) on an HP Pavilian dv9000. Intel DualCore 2GB RAM. I recently was playing around with Karamba and noticed that no swap was being used. I ran 'free -m' and this is my output:

    total used free shared buffers cached
    Mem: 2025 577 1447 0 19 295
    -/+ buffers/cache: 262 1762
    Swap: 0 0 0

    I cat'd /etc/fstab and it reads:
    /dev/sda1 swap swap defaults 0 0
    /dev/sdb1 / ext3 defaults 1 1
    /dev/sda3 /home defaults 1 2
    /dev/sda2 /boot defaults 1 2
    #/dev/cdrom /mnt/cdrom auto noauto,owner,ro 0 0
    /dev/fd0 /mnt/floppy auto noauto,owner 0 0
    devpts /dev/pts devpts gid=5,mode=620 0 0
    proc /proc proc defaults 0 0
    #/dev/sdc1 /mnt/usbdisk vfat users,rw,noauto,unhide 0 0

    I fdisk'd '/dev/sda1 and it hit 'p' and it says:

    root@darkstar:/home/wahcordian# fdisk /dev/sda1

    Command (m for help): p

    Disk /dev/sda1: 4211 MB, 4211311104 bytes
    255 heads, 63 sectors/track, 511 cylinders
    Units = cylinders of 16065 * 512 = 8225280 bytes

    Device Boot Start End Blocks Id System
    /dev/sda1p1 1 511 4104576 82 Linux swap

    Command (m for help):

    So my question is... what gives? Why no swap usage? I opened a butt-load of konquerer's at the same time to see if I just wasn't putting a large enough load on it to need the swap, but I ended up using my ram and no swap space. Also, is it correct to allocate twice the swap space as available ram? ie. I have 2 GB of RAM so 4 GB of swap is a good idea?

    Thanks in advance for any answers or a kick in the right direction!
    Cheers!
    -Wahcordian

    Oh yes and I just tried 'swapon -a' and it reads:

    root@darkstar:/home/wahcordian# swapon -a
    swapon: /dev/sda1: Invalid argument

    Cheers

  2. #2
    Just Joined! wahcordian's Avatar
    Join Date
    Jul 2008
    Posts
    18
    oh oh oh and I just tried dmesg after I swapon -a and it reads: "Swap area shorter than signature indicates"

    Thats probably pretty important... I guess I should google that!

  3. #3
    Linux Engineer Freston's Avatar
    Join Date
    Mar 2007
    Location
    The Netherlands
    Posts
    1,049
    If there's no swap the machine will put a swap file on your disk. Technically, this is not a 'man overboard' type of situation.

    Some people even claim that with that much RAM you don't need any swap. Certainly, the old rule of thumb (swap = 2xRAM) doesn't really apply. It's up to you though. I probably would use a gig of swap.

    That said, having errors isn't very good. What was the output of this:
    Code:
    fdisk -l     # the l is a lower case L
    dmesg | grep -i swap
    dmesg | grep -i other_errors
    Quote Originally Posted by wahcordian
    oh oh oh and I just tried dmesg after I swapon -a and it reads: "Swap area shorter than signature indicates"

    Thats probably pretty important... I guess I should google that!
    Hmmm, yeah. That does seem important.
    Can't tell an OS by it's GUI

  4. #4
    Just Joined! wahcordian's Avatar
    Join Date
    Jul 2008
    Posts
    18
    Thanks for the response. The googling wasn't as helpful as I'd hoped. Here's the output for the commands:

    root@darkstar:/home/wahcordian# fdisk -l

    Device Boot Start End Blocks Id System
    /dev/sda1 1 512 4112608+ 82 Linux swap
    /dev/sda2 * 513 514 16065 83 Linux
    /dev/sda3 515 14593 113089567+ 83 Linux

    Disk /dev/sdb: 80.0 GB, 80026361856 bytes
    255 heads, 63 sectors/track, 9729 cylinders
    Units = cylinders of 16065 * 512 = 8225280 bytes

    Device Boot Start End Blocks Id System
    /dev/sdb1 1 9729 78148161 83 Linux

    root@darkstar:/home/wahcordian# dmesg | grep -i swap
    Adding 4112600k swap on /dev/sda1. Priority:-1 extents:1 across:4112600k

    the las dmesg grep didn't return anything.

  5. #5
    Linux Engineer Freston's Avatar
    Join Date
    Mar 2007
    Location
    The Netherlands
    Posts
    1,049
    Quote Originally Posted by wahcordian
    Code:
    root@darkstar:/home/wahcordian# fdisk -l
     
       Device Boot      Start         End      Blocks   Id  System
    /dev/sda1               1         512     4112608+  82  Linux swap
    /dev/sda2   *         513         514       16065   83  Linux
    /dev/sda3             515       14593   113089567+  83  Linux
     
    Disk /dev/sdb: 80.0 GB, 80026361856 bytes
    255 heads, 63 sectors/track, 9729 cylinders
    Units = cylinders of 16065 * 512 = 8225280 bytes
     
       Device Boot      Start         End      Blocks   Id  System
    /dev/sdb1               1        9729    78148161   83  Linux
     
    root@darkstar:/home/wahcordian# dmesg | grep -i swap
    Adding 4112600k swap on /dev/sda1.  Priority:-1 extents:1 across:4112600k
    For all I can see here, everything looks fine. Does it work now??


    Quote Originally Posted by wahcordian
    the las dmesg grep didn't return anything.
    No that was not meant literally

    Whenever I find myself in trouble, and I don't know where to start looking, I just fire a range of searches at the logs.
    Something like:
    Code:
    dmesg|grep -i error
    dmesg|grep -iv default|grep -i fault
    dmesg|grep -iv debug|grep -i bug
    dmesg|grep -i not
    dmesg|grep -i swap
    dmesg|grep -i partition
    dmesg|grep -i problem
    dmesg|grep -i unable
    dmesg|grep -i whatever you can think off
    Because if there is something wrong with the machine, it's bound to complain about it somewhere, somehow. And error messages give something to work with. (Also, it's a good checkup on the overall condition of your install)

    Does that come up with anything?
    Can't tell an OS by it's GUI

  6. #6
    Linux Guru coopstah13's Avatar
    Join Date
    Nov 2007
    Location
    NH, USA
    Posts
    3,149
    i wouldn't worry about it, you'll be pretty hard pressed to use up 2 gb of ram

    if your system isn't using the swap, then it doesn't need to
    linux memory management is different from windows, it caches files in memory for performance, those cached files will be replaced by actual memory allocation by applications, if that memory runs out then swap comes into play, my guess is you just aren't filling it up the memory and therefore are not in need of swap

  7. #7
    Linux Engineer Freston's Avatar
    Join Date
    Mar 2007
    Location
    The Netherlands
    Posts
    1,049
    Quote Originally Posted by coopstah13
    i wouldn't worry about it, you'll be pretty hard pressed to use up 2 gb of ram

    if your system isn't using the swap, then it doesn't need to
    linux memory management is different from windows, it caches files in memory for performance, those cached files will be replaced by actual memory allocation by applications, if that memory runs out then swap comes into play, my guess is you just aren't filling it up the memory and therefore are not in need of swap
    Same here. No worries. And as said, having no swap doesn't cripple the system. It's just cleaner. But if it was my system, I wouldn't like it to have configs that lead to errors.
    Can't tell an OS by it's GUI

  8. #8
    Just Joined! wahcordian's Avatar
    Join Date
    Jul 2008
    Posts
    18
    Well, I haven't really seen my ram jump above around a gig as of late. So no swap usage thus far. I'll keep an eye on it. I know it's not a big deal, but part of usin' Linux is getting things working and understanding why they work or don't work. When I run swapon -a now it doesn't return errors. Including after a reboot, so thats a good sign
    grepped a few dmesg's

    root@darkstar:/home/wahcordian/tmp# dmesg | grep sda1
    sda: sda1 sda2 sda3
    Adding 4112600k swap on /dev/sda1. Priority:-1 extents:1 across:4112600k
    root@darkstar:/home/wahcordian/tmp# dmesg | grep swap
    Adding 4112600k swap on /dev/sda1. Priority:-1 extents:1 across:4112600k

    all greps for 'error' 'Error' and 'ERROR' turned up with nothing

  9. #9
    Just Joined! wahcordian's Avatar
    Join Date
    Jul 2008
    Posts
    18
    Well I've been running Amarok, Open Office, Mozilla, and a few other Apps. Ram does jump up to close to 2GB, I understand that it's mostly caching, but I'm still concerned that not having swap functioning is a misconfiguration issue. Is there anything else you can recommend?

  10. #10
    Just Joined! wahcordian's Avatar
    Join Date
    Jul 2008
    Posts
    18
    haha nevermind, it must be working because I'm using 2 of 4016mb of swap according to 'free -m'

Page 1 of 2 1 2 LastLast

Posting Permissions

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