Enable a swap on any external drive connected (USB also)
In today's article we deal with computer and speed. Consequence of the granting of Windows 7 I became aware of a new, small utility: ReadyBoost. In practice is nothing more than a swap USB drive: enter the key, enable ReadyBoost on the stick, disappears from the key resources and is used for storage of temporary files (not all, some files targeted).
Perhaps not everyone knows that enable a swap USB is not recommended due to (maybe three) main reasons:
- The USB memory essendo esterna may be mistakenly removed from its seat, creating a temporary damage to the system would no longer access to the data they are working on,
- The transfer speed date your USB is extremely lower compared to the speed of the disc. Do not expect your computer with 1gb of ram travels as if he had 8 with a stick 8gb, expect instead that the computer goes even slower, data transfer over USB interface is slow and a lot compared to the traditional IDE or ATA.
- Although this is a secondary issue, it is good to mention it: i cicli di lettura / Writing on the mass storage in the solid state are limited in time, when used in this way, our lives will have USB stick shorter other.
The computer will, instead, faster if the swap enabled resides in a disc directly connected to the motherboard (I'm talking about internal dschi: IDE, the ATA, not USB). In this case the head of the main disk would continue to read and write without skipping from the partition data to the swap partition saving a fraction of a second. Council, therefore, to those who want to enable an additional swap use a partition of a disk inside the computer, certainly not a USB stick.
That said we're doing now in the enterprise to enable swap on a disk that is not the main one where the operating system resides. This procedure can also be enabled to use the USB flash drive as an external ram, but as I stated before is not a procedure that I recommend.
- Connect the unit memory to the computer (if it is already connected and mounted we find the corresponding device, read the footnotes to determine the device),
- We perform from the terminal command
- If the device is mounted must be “disassemble“. Always terminale: “
sudo umount /media/from”,
- We assign the swap to our device:
sudo mkswap /dev/sdd1(always “sdd1” is the device that you want “swappare”,
- “Turn on” The swap with “
sudo swapon -p 32767 /dev/sdd1“.
The swap is now enabled. The option “-p 32767” This last command is used to set the priority. In the case of a second internal disk to the computer board of set high (“-p 1”), if it is a USB drive (I do not recommend using it, but who wants to “hack” smanetti) Set a high value to assign a background. To control the use the swap is possible to launch “
cat /proc/swaps“, the result is this:
In this case I assigned a high priority (low value), and the newly created swap will be used before the other, with consequent savings (albeit small) on loading times.
How to determine the device
To determine the device used by the memory that we want to use as swap is enough to launch a
df -m from terminal (in case it is mounted) and carefully check which device touch. When in doubt DO NOT TOUCH ANYTHING, this procedure could erase the data on a partition or a disk. If you do not know what you're doing, stop and re-read from the beginning, or even LEFT TO LOSE.
The command “
In my case the command “
df -m” returns the following result:
Troviamo the list of devices under the first column, it total space, it space occupied, it free space, the percentage of employment and the mount point. In this case the device /dev/sdd1 is mounted in /media / z. That will be the device to be removed.