Yellow Dog Solutions

TOPIC: Use Flash memory for swap space on a PS3



The following topic was written by Ilian Tzankov

Aside from the great looks and being a truly remarkable machine, I bought a PS3 was the fact that I could install Linux on it. As soon as I found the Terra Soft website I started the YDL 5.0 download and ran to the shop to get my PS3. Abount an hour later my linux booted, and I realized there are few things I had not considered. These are as I see them the main disadvantages of the PS3, when it comes to Linux:

  • It runs linux in a hipervisor - this means disk access is very slow, video is confined to framebuffer only and is very slow as well
  • The system memory is extremely limited.
In this article I want to share a cool solution I've found to these limitations. When running Linux on the PS3, the limited amount of memory causes the system to swap a lot (i.e. it uses the hard disk for memory). Now considering the slow disk IO (26MB/s!) starting and even using programs can be a real pain.

The solution I have is using flash storage to improve this. Since flash card access is also quite slow also I use 2 storage devices:
  • a 512MB SD card
  • a 1GB usb stick
Under my system the SD card shows up as "/dev/sdd" and the USB key as "/dev/sdf", these might not be same for you. This procedure assumes your flash devices have been previously formated for you and contain a partition table.

WARNING! This procedure will destroy all data on the SD card and the USB key!

  1. Open a terminal

  2. Enter the following commands:
    su
    [type in your root password]
    /sbin/mkswap /dev/sdd1
    /sbin/mkswap /dev/sdf1
    /sbin/swapoff -a
    /sbin/swapon -p 1 /dev/sdd1
    /sbin/swapon -p 1 /dev/sdf1
  3. You are now running with swap space evenly distributed between the two flash devices.
  4. Edit the following file:
    /etc/fstab
  5. Remove the line that contains the word "swap" in it.
  6. Add these two lines:
    /dev/sdd1 swap swap pri=1 0 0
    /dev/sdf1 swap swap pri=1 0 0
You are done!
Ilian Tzankov

Back to the Index




 
          Copyright ® 1999-2010. Fixstars Corporation. All rights reserved.
YDL.net Fixstars Corporation