Re: swapon reports wrong swapsize

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Feb 16, 2010 at 10:56:56AM +0100, Peter Breitenlohner wrote:
> Hi,
>
> I just noticed that 'swapon -av' says:
>
>   swapon on /dev/sda2
>   swapon: /dev/sda2: found swap v1 signature string for 4 KiB PAGE_SIZE
>
>   swapon: /dev/sda2: pagesize=4096, swapsize=3716452352, devsize=8011422720
>
> whereas '/proc/swaps', 'free', and 'top' all report the size as 7823644.
> Where does that number 3716452352 come from?
>
> This is from util-linux-ng-2.16.2, running on Linux 2.6.28.6-x86_64 but
> compiled for 2.6.28.6-i686.  As far as I can see from the current git, the
> computations in lib/blkdev.c and mount/swapon.c are still the same.

 The number from /proc/swaps is in KiB. The swapsize= from swapon
 verbose message is a size calculated from the 'lastpage' field from
 swap header.

 My laptop:

 # swapon -v /dev/sda3
 swapon: /dev/sda3: found swap signature: version 1, page-size 4, same byte order
 swapon: /dev/sda3: pagesize=4096, swapsize=2410004480, devsize=2410007040

 # cat /proc/swaps 
 Filename                                Type            Size    Used  Priority
 /dev/sda3                               partition       2353512 0     -1

  
          swaps: 2353512 * 1024   = 2409996288

          swapon:                 = 2410004480

         
          2410004480 - 2409996288 = 8192


  8192 are two pages -- I guess it's the first and last page that are not used 
  by swap, or so...

    Karel

-- 
 Karel Zak  <kzak@xxxxxxxxxx>
--
To unsubscribe from this list: send the line "unsubscribe util-linux-ng" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux