No announcement yet.

How much portion of RAM is allocated to Swap space?

  • Filter
  • Time
  • Show
Clear All
new posts

  • How much portion of RAM is allocated to Swap space?

    How swap is getting 12GB as its size as per the below output:

    Filesystem size used avail capacity Mounted on
    /dev/md/dsk/d0 7.9G 2.1G 5.7G 27% /
    /devices 0K 0K 0K 0% /devices
    ctfs 0K 0K 0K 0% /system/contract
    proc 0K 0K 0K 0% /proc
    mnttab 0K 0K 0K 0% /etc/mnttab
    swap 12G 1.2M 12G 1% /etc/svc/volatile
    objfs 0K 0K 0K 0% /system/object
    sharefs 0K 0K 0K 0% /etc/dfs/sharetab
    7.9G 2.1G 5.7G 27% /platform/sun4u-us3/lib/
    7.9G 2.1G 5.7G 27% /platform/sun4u-us3/lib/sparcv9/
    fd 0K 0K 0K 0% /dev/fd
    /dev/md/dsk/d3 7.9G 386M 7.4G 5% /var
    swap 512M 216K 512M 1% /tmp
    swap 12G 40K 12G 1% /var/run
    /dev/md/dsk/d6 30G 766M 29G 3% /u02
    /dev/md/dsk/d2 9.9G 92M 9.7G 1% /u01
    /dev/md/dsk/d7 12G 3.8G 7.9G 33% /u03
    /dev/md/dsk/d8 30G 1.1G 28G 4% /u04
    /dev/md/dsk/d40 290G 2.0G 285G 1% /appdata
    /dev/md/dsk/d4 12G 1.4G 10G 13% /opt/ems
    /dev/dsk/c1t0d0s7 7.9G 1.5G 6.3G 20% /export/home
    /dev/lofi/1 1.8G 1.8G 0K 100% /cdrom

    ems15:~# swap -l
    swapfile dev swaplo blocks free
    /dev/dsk/c1t0d0s1 32,1 16 16790384 16790384
    ems15:~# swap -s
    total: 1861848k bytes allocated 421304k reserved = 2283152k used, 12779832k available
    ems15:~# prtconf -v | grep -i mem
    Memory size: 8192 Megabytes

    ? How swap size is populating it as ?12GB?.
    ? If we see the swap ?s output, total swap space is (2283152k used 12779832k available = 14.37 GB). Theoretically we know that swap space is sum of hard disk allocated for swap space during partition and few portion of real memory i.e. RAM. If that is the scenario, in the above system we are having 8GB real memory. My question is how much percentage of real memory is allocated for swap space. Is there any command to find that? Why swap is not showing this 14.37 GB as its size in df ?h output rather its showing 12GB.


  • #2
    essentially the number of blocks is twice the number of kilobytes ...

    > swap -l
    > swapfile dev swaplo blocks free
    > /dev/dsk/c1t0d0s1 32,1 16 16790384 16790384

    so you have:
    laptop% dc
    16790384 2 / p
    1024 / p
    1024 / p

    i.e. 8 Gb of swap file.

    which would lead me to think you should have 16Gb of swap, but that's another story

    the df is showing you the swap available for files in /tmp for example, the allocated and reserved swap cannot be used for this that is why it is not shown.

    If it helps any (not that it does) A sun engineer told me when I asked that "It isn't as easy as that!" ... but he then never went on to explain what it was


    • #3
      Thanks for your response. But still i didnt get answer for my query. How much of portion of RAM is being allocated during swap space allocation.



      • #4
        all of it ...


        • #5
          I didnt understand what you are trying to convey. Can u please explain it little bit eloborately??????


          • #6
            swap = disk file + physical memory

            on a Solaris box.

            if you have shared graphics memory then this will be deducted, but when you type swap -s it should show you what it's actually got in it.


            • #7
              u r ri8. I heard that command 'memstat' will give the memory allocation details. Problem is this command is not present in the server. Do you know the way how to know the RAM portion either by command or scripts????


              • #8
                I've been told it's not "correct" but you could use "top" if you got it from the companion CD (or sunfreeware) ... that displays usage.

                "prstat" shows usage for all processes (and also shows threads much better than "top" but doesn't show the total memory usage)

                you can "prstat -t" and do the sums yourself though