More Data: v1.10.0 swapon: swapfile has holes - blocksize ?

Denys Vlasenko vda.linux at googlemail.com
Thu Mar 27 16:46:13 UTC 2008


On Thursday 27 March 2008 15:04, Jonathan Moore wrote:
> More data follows ....
> 
> /mnt $ dd if=/dev/zero of=/mnt/swapfile bs=1024 count=65536
> 65536+0 records in
> 65536+0 records out
> /mnt $ mkswap /mnt/swapfile
> Setting up swapspace version 1, size = 67104768 bytes
> /mnt $ swapon /mnt/swapfile
> swapon: blocks 131200 size 67108864
> swapon: swapfile has holes  <======================== ??!!!

You DEFINITELY do not use 1.10.0. slightly different error message
is a dead giveaway.

> swapon: /mnt/swapfile: Invalid argument
> 
> mkswap and the extra debug output don't state the same size.

mkswap says what is the usable swap size is. That is, minus header.

> Swapon is larger. Although blocks * 512 is larger than st.st_size,

Yes. 131200 * 512 == 67174400 which is > 67108864.

Probably because filesystem reports also indirect blocks used, etc...

> so no error statement is generated. I wonder if swapon believes
> the file is larger than it actually is?

No. "size 67108864", and 67108864 / 1024 == 65536.
Exactly what you specified for dd. swapon sees correct file size.

I did the same test on my machine:

bash-3.2# dd if=/dev/zero of=/mnt/swapfile bs=1024 count=65536
65536+0 records in
65536+0 records out
bash-3.2# mkswap /mnt/swapfile
Setting up swapspace version 1, size = 67104768 bytes
bash-3.2# ./busybox swapon /mnt/swapfile
swapon: blocks 131200 size 67108864  <============= DEBUG DATA same as yours

 swapon succeeded!

bash-3.2# swapoff /mnt/swapfile
bash-3.2# rm /mnt/swapfile


I think you are simply trying to swap on a filesystem
which does not support that.
--
vda



More information about the busybox mailing list