Cookie

Enable a swap on any external drive connected (USB also)

Published by TheJoe on

Estimated reading time: 3 minutes

Caution


This article was published more than a year ago, there may have been developments.
Please take this into account.

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:

  1. 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,
  2. 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.
  3. 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 df -m,
  • 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 onThe swap with “sudo swapon -p 32767 /dev/sdd1“.
Look here:  Linux also has a children's applications "portable", but it is necessary?

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 “df -m

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.


TheJoe

I keep this blog as a hobby by 2009. I am passionate about graphic, technology, software Open Source. Among my articles will be easy to find music, and some personal thoughts, but I prefer the direct line of the blog mainly to technology. For more information contact me.

5 Comments

Martiño Salvétti · 19 April 2013 at 10:33 AM

The USB flash drives are slower than a disc, However, the latency should be less well having no head that you must correctly position, wait for the right fraction of the hard steps below and can be accessed. Hard disks fail to achieve the best performance only by reading large amounts of data sequentially; then, maybe that is not a good memory stick 10MB / s write and a 15in performance in reading represents more of a disk PATA / SATA 40MB / s? Maybe is also lengthened the life of the disc, less stressed by the constant movement of the head between the data partition and the swap

davideatflickr · 18 April 2011 at 8:34 PM

: )

    Giovanni Mauri · 23 April 2013 at 3:32 PM

    From the tests I've done I, in all cases the disks have proven faster, Try it.. perhaps with different disk and stick you better results..
    Anyhow, even if you try to search around for the network, almost anyone who does not recommend this practice, because of the slowness of the data exchange on the bus usb, but above all because of the limits to the cycles read / write memories ssd.

TheJoe · 18 April 2011 at 2:04 PM

Thanks David, Good to see you here among my articles :D..

Even if the scratch disk in Photoshop I see it is recommended to use internal drives (IDE or ATA, or partitions on the same disk)… you could say that Photoshop uses his personal swaps. 😉

A few brief tutorial for Gimp, maybe those type of course..

davideatflickr · 18 April 2011 at 1:06 PM

nice article..
un escamotage tipo Scratch Disk per Photoshop..
good work
hello

Leave a Reply

Avatar placeholder

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.