December 6, 2010

1

How to Add Swap on ts-7260 Linux

For any reason, you may need extra memory on your ts-7260 SBC but the build in RAM is only 28MB. In my case, it get rebooted when I'm running few programs that continuously reading the input from the DIO. As this system is running linux, we can use swap memory instead of physical RAM. So, to solve this problem, we can create swap file on this ts-7260. Here is how to add swapfile on ts-7260 board running the default debian Sarge on ts11 kernel 2.4 SD card boot linux.

Let's check the free memory...
root@ts7000:root# free -m
total       used       free     shared    buffers     cached
Mem:            28         26          1          0          1         18
-/+ buffers/cache:          6         21
Swap:            0          0          0

From the above result, you can see the total memory is 28 and we have 0 on swap. Now, we have to create the swapfile using this command:

root@ts7000:root# dd if=/dev/zero of=/swapfile bs=1024 count=98304
98304+0 records in
98304+0 records out
100663296 bytes transferred in 75.990000 seconds (1324691 bytes/sec)
root@ts7000:root# mkswap -L swapfile /swapfile
Setting up swapspace version 1, size = 100659 kB
LABEL=swapfile, UUID=6c0cf1ae-d174-48c6-99ac-cc9f2a35ba21
root@ts7000:root# swapon /swapfile 

Check free memory again

root@ts7000:root# free -m
total       used       free     shared    buffers     cached
Mem:            28         26          1          0          1         18
-/+ buffers/cache:          6         21
Swap:           95          0         95
root@ts7000:root# 

Now, you should see there is 95MB swap. And to make it permanent, add this entry on /etc/fstab

/swapfile none swap sw 0 0

as the command goes...

root@ts7000:root# cat /etc/fstab
proc             /proc         proc    defaults                 0    0
none            /dev/pts        devpts        gid=5,mode=620    0 0
/dev/sdcard0/disc0/part3 / ext2 defaults,noatime,async 1 1 
root@ts7000:root# vi /etc/fstab
root@ts7000:root# cat /etc/fstab
proc             /proc         proc    defaults                 0    0
none            /dev/pts        devpts        gid=5,mode=620    0 0
/dev/sdcard0/disc0/part3 / ext2 defaults,noatime,async 1 1 
/swapfile none swap sw 0 0

I hope this can help you with your ts-7260 SBC. Have fun!! Don't forget to follow me on Coder's Talk

...Read more

Share This Article:


Bookmark This Article:
Feed Me Digg Technorati del.icio.us Best to Stumbleupon Reddit Blinklist Furl Spurl Yahoo Simpy