creating swap

I found a 16MB smartmedia card laying around and figured it would be good for swap. Note that I had to install fdisk from the backports repository. I had previously partitioned the CF card when tooling around, so I didn't need it to mount the CF card as root, just e2fsprogs to reformat it. Anyway, on with the show:

# install fdisk
ipkg install fdisk
#find the partition
fdisk -l
# create the swap partition (partition 1, type 82)
fdisk /dev/scsi/host0/bus0/target0/lun2/disc
# install swap-utils
ipkg install swap-utils
# make it a swap partition
mkswap /dev/scsi/host0/bus0/target0/lun2/part1
# and do it
swapon /dev/scsi/host0/bus0/target0/lun2/part1
swapon -s
# make it persistent
echo "/usr/sbin/swapon /dev/scsi/host0/bus0/target0/lun2/part1" > /etc/init.d/S11swap
chmod 755 /etc/init.d/S11swap

Now I've got more virtual mem to do... something with.

root@OpenWrt:/etc# swapon -s
Filename Type Size Used Priority
/dev/scsi/host0/bus0/target0/lun2/part1 partition 15984 0 -2
root@OpenWrt:/etc# cat /proc/meminfo
total: used: free: shared: buffers: cached:
Mem: 31289344 12382208 18907136 0 770048 3854336
Swap: 16367616 0 16367616
MemTotal: 30556 kB
MemFree: 18464 kB
MemShared: 0 kB
Buffers: 752 kB
Cached: 3764 kB
SwapCached: 0 kB
Active: 2820 kB
Inactive: 1724 kB
HighTotal: 0 kB
HighFree: 0 kB
LowTotal: 30556 kB
LowFree: 18464 kB
SwapTotal: 15984 kB
SwapFree: 15984 kB

You can also read slightly less verbose instructions on the OpenWrt wiki.

No comments:

Ratings and Recommendations by outbrain