Sunday, May 5, 2024
 Popular · Latest · Hot · Upcoming
6
rated 0 times [  6] [ 0]  / answers: 1 / hits: 10728  / 2 Years ago, mon, january 3, 2022, 5:17:49

After searching here, I found no direct answer to:



Is it practical to put swap on a USB Flash drive? I do not yet know if the teeny-tiny flash drive (Fit CZ33 ) I wish to use runs at high-speed (480 Mbps), full-speed (12 Mbps), or low-speed (1.5 Mbps), but am checking w/ SanDisk.



My intent is to reduce writes on the SSD for drive longevity; if the external flashdrive fails, I throw it away and get another.



Why? Because I just changed my ThinkPad R60 9459AT8 over to a Samsung SSD after maxing out the RAM at 3GB, set up trim after repartitioning with 20% free, removed swap, set swappiness to 0 and otherwise tuned up Xubuntu 13.10 for SSD. However, since it's not practical for me to add a mechanical HDD, I'd like to move the swap over to a Flashdrive which will always stay in the left side USB2 socket, for I'dather wear out a $12 flashdrive instead of a $180 SSD.



Why? Sometimes, I lose my WiFi connection until I reboot, plus rarely see slowdown, and I'd like to see if having swap again would help. I do watch a system monitor always in a panel and never exceed 30% free memory use, but would like to have swap without putting in on the SSD.



Yea, or nay?



And, does the size of the flashdrive make any difference: 8GB, 16GB or 32GB?


More From » 13.10

 Answers
5

Flash drives are slower.
My SSD is older and half the speed of newer systems and my system is all SATA2 and USB2.



sudo hdparm -t /dev/sdd4



older SSD drive:
Timing buffered disk reads: 626 MB in 3.01 seconds = 208.20 MB/sec



Older 160GB rotating drive:
Timing buffered disk reads: 212 MB in 3.01 seconds = 70.46 MB/sec



USB2 flash drive
Timing buffered disk reads: 50 MB in 3.07 seconds = 16.26 MB/sec




Or my flash drive is only 10% as fast for reading as my slow SSD. And writes are notoriously slow on flash drives.



You can set swappiness to use RAM first.



cat /proc/sys/vm/swappiness
gksudo gedit /etc/sysctl.conf


Add this:



vm.swappiness=10


https://help.ubuntu.com/community/SwapFaq#What_is_swappiness_and_how_do_I_change_it.3F



There is the swapspace or dynamic swap manager. Looks like not maintained, but still in repository of 12.04.



sudo apt-get install swapspace


http://pqxx.org/development/swapspace/


[#28163] Tuesday, January 4, 2022, 2 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
azaaburge

Total Points: 266
Total Questions: 85
Total Answers: 109

Location: Djibouti
Member since Sat, Oct 29, 2022
2 Years ago
;