Problem recovering space from swap file

I have just loaded nto rt on to a small (500 Mb) partition to keep the boot
stuff below the 1024 Cyl boundary. I noticed that the /.swapfile took up
most of the space so I made another (/dev/hd0t78) partition and rebooted.
The new partition was mounted at /fs/hd0-qunx4-2 and I used swapctl to make
a new 250M swap file (/fs/hd0-qnx4-2/.swapfile) there. The new file was
made and the old /.swapfile was removed from / but the space was not
recovered in the /dev/hd0t77 partition. It is still 95% full - any ideas as
to how to recover the swap file space?

I have rebooted several times - the space is still not recovered. In
addition upon reboot the swapper didn’t recognize the new file so I deleted
that too. When I removed that file the space was returned to the
/dev/hd0t78 partition - but the /dev/hd0t77 partition (primary boot) is
still 97% full.

John Sanders <jsanders@radix.net> wrote:

I have just loaded nto rt on to a small (500 Mb) partition to keep the boot
stuff below the 1024 Cyl boundary. I noticed that the /.swapfile took up
most of the space so I made another (/dev/hd0t78) partition and rebooted.
The new partition was mounted at /fs/hd0-qunx4-2 and I used swapctl to make
a new 250M swap file (/fs/hd0-qnx4-2/.swapfile) there. The new file was
made and the old /.swapfile was removed from / but the space was not
recovered in the /dev/hd0t77 partition. It is still 95% full - any ideas as
to how to recover the swap file space?

I’d imagine you have to restart since the kernel will still have the
swapfile open.


cburgess@qnx.com

Try running chkfsys - this might reclaim the space.

John Sanders <jsanders@radix.net> wrote:

I have rebooted several times - the space is still not recovered. In
addition upon reboot the swapper didn’t recognize the new file so I deleted
that too. When I removed that file the space was returned to the
/dev/hd0t78 partition - but the /dev/hd0t77 partition (primary boot) is
still 97% full.


cburgess@qnx.com

Already tried chkfsys - It just reports all of the files used and the
bitmaps match - but the filesystem is still 97% full.

Before I tried to make the swapfile on the other partition I noticed that
ls -l /.swapfile reported a BIG file. But afterward it was gone. I was
wondering if the reported ls -l size was just a maximum size and not yet
allocated - like demand zero or something??

someone was asking about a demand-zero swap file.

is a zero-init file AKA a virtual file? sparse file? or file
w/ holes? they do not SEEM to be suported under fs-qnx4.so

echo > /lf
ls -l /lf
-rw-rw-r-- 1 root root 1 Oct 13 09:03 /lf

dd if=/lf of=/virtest bs=1k seek=20

ls -l /virtest
-rw-rw-r-- 1 root root 20481 Oct 13 09:07 /virtest

du /virtest
41 /virtest
du -k /virtest
20 /virtest -<why not 21?>


So, the swapfile appears to be real (and sparse files were NOT

http://www.qnx.com/literature/nto_sysarch/fsys.html#FSYSCLASSES
just above
http://www.qnx.com/literature/nto_sysarch/fsys.html#IMAGE

listed as a POSIX feature in the QNX docs anyway)
(plus it didn’t look like it had an inode equivalent)


ls -l /.swapfile

-rw------- 1 root root 134217728 Sep 29 17:57 /.swapfile

du -k /.swapfile
131072 /.swapfile


A vitual swap file, would fail, if you never used it before,^M
filled up your filesystem, then ran something memory intensive.^M


On an ext2 partition -

mount -r -t ext2 /dev/hd2t131 /fs/hd2-ext2

dd if=/lf of=/fs/hd2-ext2/virtest bs=1k seek=20

ls -l /fs/hd2-ext2/virtest

-rw-rw-r-- 1 root root 20481 Oct 13 09:07
/fs/hd2-ext2/virtest

du /fs/hd2-ext2/virtest
41 /fs/hd2-ext2/virtest -<Hmm, this is only 2 under Linux>
size will depend on inode/block size

so fs-ext2 does the right thing writing, but either it or du
does NOT deal w/ sparse files during read.


John Sanders wrote:

wondering if the reported ls -l size was just a maximum size and not
yet allocated - like demand zero or something??


real people - remove my First and Last name (Mike- -Ferr)
off of the ends of my amateur call sign (n2kra)

so now I will attempt to use one of my Linux Swap partition

swapctl -m -a /dev/hd0t130 -<also changed in /etc/system/sysinit>
swapctl -s

when I boot back into Linux, there are no complaints !?!
Are you using the same magic number, in the same place?
Or does Linux not check carefully?

rm /.swapfile -<on QNX reboot, went OK, recovered space>

Hmm… On the last few reboots, I have not seen
the swap partition mounted, but it works manually

John Sanders wrote:

Already tried chkfsys - It just reports all of the files used and the
bitmaps match - but the filesystem is still 97% full.

Before I tried to make the swapfile on the other partition I noticed that
ls -l /.swapfile reported a BIG file. But afterward it was gone.


real people - remove my First and Last name (Mike- -Ferr)
off of the ends of my amateur call sign (n2kra)