Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230

 

 

 

SSDs & Swap on low-spec laptops

Ask for help with issues regarding the Installations of the Debian O/S.
Post Reply
Message
Author
secdroid
Posts: 38
Joined: 2009-12-18 18:38

SSDs & Swap on low-spec laptops

#1 Post by secdroid »

I am confused about the use of swap files and swap partitions with SSD drives. In addition to conflicting opinions with regard to the impact of swap on SSD longevity, there is little precision about what is "sufficient" RAM so that one can go swapless.

Usage: Debian 10 with XFCE, Firefox browser (< 8 tabs max), LibreOffice, Thunderbird, YouTube, light programming. No hibernate or suspend, just shutdown.

Systems --
  • Lenovo 14W Laptop - AMD A6-9220C (64-bit CPU), 4 GB RAM, 64 GB eMMC SSD (dual-boot 32 GB Win 10 Pro, 32 GB MX Linux), 128 GB micro SD, soon to be "daily driver"
  • HP Stream 11 Laptop - Celeron N2840 (64-bit CPU), 2 GB RAM, 32 GB eMMC SSD (MX Linux gets whole SSD), 64 GB microSD, light usage -- former "daily driver" - Currently running Debian 8.
I am leaning toward using a 4 GB swap file, not partition, on the removable microSDs. Rationale: maximize SSD lifetime on mainboard SSD, although swap performance will be reduced. Micro SD is cheap and easily replaceable.

The most (apparently) authoritative info I have found is this 2011 MSDN quote [https://superuser.com/questions/51724/s ... -ssd-drive]:
Should the pagefile be placed on SSDs?

Yes. Most pagefile operations are small random reads or larger sequential writes, both of which are types of operations that SSDs handle well.

In looking at telemetry data from thousands of traces and focusing on pagefile reads and writes, we find that
  • Pagefile.sys reads outnumber pagefile.sys writes by about 40 to 1,
  • Pagefile.sys read sizes are typically quite small, with 67% less than or equal to 4 KB, and 88% less than 16 KB.
  • Pagefile.sys writes are relatively large, with 62% greater than or equal to 128 KB and 45% being exactly 1 MB in size.
In fact, given typical pagefile reference patterns and the favorable performance characteristics SSDs have on those patterns, there are few files better than the pagefile to place on an SSD.
Would greatly appreciate guidance.

CwF
Global Moderator
Global Moderator
Posts: 2683
Joined: 2018-06-20 15:16
Location: Colorado
Has thanked: 41 times
Been thanked: 196 times

Re: SSDs & Swap on low-spec laptops

#2 Post by CwF »

For the MX I would recommend testing with zram-tools. Firefox will swap out sleeping tabs and it will give you some headroom. 128-256MB of ram for zramswap will free that much or more, and prevent usage of the swap file/partition, that should be on the primary ssd and about 1G without hibernation.

User avatar
eor2004
Posts: 251
Joined: 2013-10-01 22:49
Location: Puerto Rico
Has thanked: 4 times
Been thanked: 5 times

Re: SSDs & Swap on low-spec laptops

#3 Post by eor2004 »

Hi, I have 2 Laptops with SSD on them, one with 2Gb of Ram and a Swap partition of 2Gb, the other with 3Gb of ram and a swap partition of 4Gb, both in use more than 2 years and have no issue with them, Smart says both SSD are OK, if you want to go with no swap, make sure you have more than 4Gb of Ram memory, other option could be to create a swap file instead of a swap partition, hope this helps!
Debian 12 Gnome on a MSI H61M-P25 (B3) PC & on a Dell Latitude E6410 & HP EliteBook 8540p Laptops.
LMDE 6 on a Panasonic ToughBook CF-C1 Laptop.
Bodhi Linux 7 on a HP Compaq DC5750 Small Form Factor PC.
Windows 11 on a Intel DH55TC PC.

User avatar
Head_on_a_Stick
Posts: 14114
Joined: 2014-06-01 17:46
Location: London, England
Has thanked: 81 times
Been thanked: 133 times

Re: SSDs & Swap on low-spec laptops

#4 Post by Head_on_a_Stick »

Code: Select all

empty@E485:~ $ cat /sys/block/nvme0n1/queue/rotational                                   
0
empty@E485:~ lsblk | grep -i swap                                                    
├─nvme0n1p2 259:2    0     4G  0 part [SWAP]
empty@E485:~ $
Do I look bothered?

Read this: https://techreport.com/review/27909/the ... -all-dead/

Modern production SSDs will likely outlast their spinning rust cousins.
deadbang

p.H
Global Moderator
Global Moderator
Posts: 3049
Joined: 2017-09-17 07:12
Has thanked: 5 times
Been thanked: 132 times

Re: SSDs & Swap on low-spec laptops

#5 Post by p.H »

I wonder, do eMMC devices qualify as modern SSDs ? Do they have sophisticated flash controllers like modern SATA or NVMe SSDs ?

User avatar
Head_on_a_Stick
Posts: 14114
Joined: 2014-06-01 17:46
Location: London, England
Has thanked: 81 times
Been thanked: 133 times

Re: SSDs & Swap on low-spec laptops

#6 Post by Head_on_a_Stick »

^ Good point, I missed the eMMC bit.

A bit old but useful: https://www.elinux.org/images/2/2c/Wear ... Memory.pdf

@OP: try

Code: Select all

# apt install mmc-utils
# mmc extcsd read /dev/mmcblk1 | grep 'LIFE\|EOL'
Adjust the block device as required.
deadbang

secdroid
Posts: 38
Joined: 2009-12-18 18:38

Re: SSDs & Swap on low-spec laptops

#7 Post by secdroid »

Thanks to all for the responses.

I was not aware of ZRam. It looks like I have a perfect use case for it. I started with https://wiki.debian.org/ZRam which links https://en.wikipedia.org/wiki/Zram which, in turn links lots of good info. Wikipedia also linked to https://en.wikipedia.org/wiki/Solid-state_drive#SWAP which said --
Swap partitions
  • According to Microsoft's former Windows division president Steven Sinofsky, "there are few files better than the pagefile to place on an SSD".[232] According to collected telemetry data, Microsoft had found the pagefile.sys to be an ideal match for SSD storage.[232]
  • Linux swap partitions are by default performing TRIM operations when the underlying block device supports TRIM, with the possibility to turn them off, or to select between one-time or continuous TRIM operations.[197][198][199]
I will definitely pursue adopting ZRam for both laptops.

***

eMMC vs. SSD storage: What's the difference? https://www.windowscentral.com/emmc-vs-ssd

***

FWIW, this HP Stream 11 got a 4 GB swap partition when I installed Debian 8/LXDE back in December 2015. [It came with Windows 8.1 --- yuck]. The eMMC SSD is soldered to the mobo, as is the battery. So far, SSD and battery are still going strong.

After reading all the conflicting stuff about SSDs and swap, I want to try to optimize my MX 19 [Debian 10 XFCE] installs.

secdroid
Posts: 38
Joined: 2009-12-18 18:38

Re: SSDs & Swap on low-spec laptops

#8 Post by secdroid »

Head_on_a_Stick wrote: @OP: try

Code: Select all

# apt install mmc-utils
# mmc extcsd read /dev/mmcblk1 | grep 'LIFE\|EOL'
Adjust the block device as required.
Test results from the HP Stream 11 with 32 GB eMMC running Debian 8 for 4 years. Tested with Buster on MX 19 live USB because there was no mmc-utils in Jesse.

Code: Select all

root@mx1:/home/demo# lsblk
NAME         MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
loop0          7:0    0  1.4G  1 loop /live/linux
sda            8:0    1 14.6G  0 disk
├─sda1         8:1    1  1.4G  0 part /live/boot-dev
└─sda2         8:2    1  3.1M  0 part
sdb            8:16   1 59.5G  0 disk
└─sdb1         8:17   1 59.5G  0 part
mmcblk0      179:0    0 29.1G  0 disk
├─mmcblk0p1  179:1    0  7.4G  0 part
├─mmcblk0p2  179:2    0    1K  0 part
├─mmcblk0p5  179:5    0  962M  0 part [SWAP]
└─mmcblk0p6  179:6    0 20.8G  0 part
mmcblk0boot0 179:256  0    4M  1 disk
mmcblk0boot1 179:512  0    4M  1 disk

root@mx1:/home/demo#  mmc extcsd read /dev/mmcblk0 | grep 'LIFE\|EOL'
eMMC Life Time Estimation A [EXT_CSD_DEVICE_LIFE_TIME_EST_TYP_A]: 0x01
eMMC Life Time Estimation B [EXT_CSD_DEVICE_LIFE_TIME_EST_TYP_B]: 0x02
eMMC Pre EOL information [EXT_CSD_PRE_EOL_INFO]: 0x01
If I understand the results correctly, 0x01 means 0-10% of the reserved blocks have been used and 0x02 means 10-20% of the reserved blocks have been used. I've not been able to find much info on interpretation of these results. Some header file?

User avatar
Head_on_a_Stick
Posts: 14114
Joined: 2014-06-01 17:46
Location: London, England
Has thanked: 81 times
Been thanked: 133 times

Re: SSDs & Swap on low-spec laptops

#9 Post by Head_on_a_Stick »

secdroid wrote:If I understand the results correctly, 0x01 means 0-10% of the reserved blocks have been used and 0x02 means 10-20% of the reserved blocks have been used.
Yes, I think so. See page 15 of the PDF I linked earlier for a breakdown. The EOL bit has three options and yours is in the "safe" zone.
deadbang

secdroid
Posts: 38
Joined: 2009-12-18 18:38

Re: SSDs & Swap on low-spec laptops

#10 Post by secdroid »

Head_on_a_Stick wrote: A bit old but useful: https://www.elinux.org/images/2/2c/Wear ... Memory.pdf
Some background info for the cited slide deck -- https://www.cnx-software.com/2019/08/16 ... sh-memory/
Health Status as Defined in the eMMC 5.0 Standard Onwards

Since e.MMC 5.0, device health status became part of the standard. It provides life time estimation for SLC and MLC areas as well as pre EOL status:
  • Device life time estimation type A: life time estimation for SLC eraseblocks, provided in steps of 10%, e.g.:
    - 0x02 means 10%-20% device life time used.
  • Device life time estimation type B: life time estimation for MLC eraseblocks, provided in steps of 10%, e.g.:
    - 0x02 means 10%-20% device life time used.
  • Pre EOL information: overall status for reserved blocks. Possible values are:
    - 0x00 - Not defined.
    - 0x01 - Normal: consumed less than 80% of the reserved blocks.
    - 0x02 - Warning: consumed 80% of the reserved blocks.
    - 0x03 - Urgent: consumed 90% of the reserved blocks.
Source - https://developer.toradex.com/knowledge-base/emmc-linux
Thanks for all the help!

Post Reply