In my previous post on readyboost I tried to explain out the basic ideology of the technique called readyboost and also some performance statistics to support the theory. Well that was for Microsoft operating systems [dedicatedly available in Vista or newer and have to be manually configured in older OSs].
The idea of readyboost is simple. For machines with low RAM, whenever the data access requirements over-flood the RAM, the OS starts to pass the least probably-important data to the page files on the hard disk and loads currently required/most important/high priority data on to the RAM from the hard disk/page files. This is where the machine slows down. Activating the readyboost adds another layer in between the page files and the RAM in the data access hierarchy. Thus whenever the ram over-floods, the new data is loaded from the flash drive and the old data is passed to the flash drive. In the flash drive also data is collected and maintained in the same manner as the RAM.
Now, Linux also uses something similar to the paging file systems called the swap partition. Swap partitions do the almost the same job that is done by the page files in the windows environment. So it is possible to create swap partition on a flash drive. As because flash drives give a higher access speed, the swap partition will be faster on the flash drive. And if we assign priority to the flash drive swap compared to the dedicated hard disk swap, the flash drive enters in to the hierarchy scheme and performs almost the same way as the readyboost concept.
Now the most important thing….. HOW TO DO IT…. [the code is for ubuntu]
Open the terminal.
i> Plug-in the flash drive.
ii> Linux shall automount the drive. Then you have to unmounts it
Sudo unmounts /media/”usbdisk”
iii> Now find the usb device in the terminal using the command
Sudo df –h [it will be something like /ev/sda1 or /dev/sdb2 etc. I am considering /dev/sda1 here]
iv> Sudo mkswap /dev/sda1 [creating the swap at the /dev/sda1 flash drive]
v> Sudo swapon –p 32767 /dev/sda1 [-p is to activate a partition and not a file. Anf the number 32767 is the priority number. Linux processes support a priority range of 0-32767. 0 being the min priority and 32767 being the highest]
Ok. The flash drive is now working as a swap partition. It’s better to format the flash drive in exfat file system [specially ext4] as the swap partition works best on that file system.
To verify the swap partition being operational type the following code on terminal
Cat /proc/swaps
If the swap partition is active, then it will be shown on the output list along with the dedicated hard drive swap partition(s).
To turn the “ReadyBoost” off on the linux [Ubuntu] type this code on terminal
Sudo swapoff /dev/sda1 [/dev/sda1 here is the flashdrive as detected in step 3]
Not at all. ReadyBoost just caches small files from the HD onto a USB stick, so that the numerous reads of small files involved in booting/launching an app are faster, since Flash memory is much quicker the HDs at small random reads. ReadyBoost does NOT act as a swap file, which is very easy to check: get your PC swapping, take the USB key out: nothing happens, the PC keeps running. It if were swapping to the USB, it would crash.
ReplyDeleteNo, not really. It's true ReadyBoost is made to work with small files for the reasons you cited, but the system not crashing if the flash drive is removed means that the data is mirrored.
DeleteReadyBoot also makes specific provision to limit the number of writes made to the flash device, which is not done when using it as a swap device as indicated here. A machine running with a heavy swap load will run faster, but the large number of writes to the flash will wear it out more quickly than you might expect -- at which time the swap starts returning errors...
ReplyDeleteProper ReadyBoost style is rolling into the kernel at version 3.10, with bcache coming into supplement the dm-cache in since 3.09. (http://www.h-online.com/open/news/item/Feature-set-of-Linux-3-10-defined-1861273.html)