News, tips, advice, support for Windows, Office, PCs & more
Home icon Home icon Home icon Email icon RSS icon

We're community supported and proud of it!

  • Can a swapfile be put on an SD card?

    Home Forums AskWoody support Non-Windows operating systems Linux – all distros Can a swapfile be put on an SD card?

    Viewing 7 reply threads
    • Author
      Posts
      • #2345845
        Charlie
        AskWoody Plus

        We’ve probably all heard of using a flashdrive to put a swapfile on to improve performance.  The thought occurred to me to use an SD memory card to do the same thing.  My old Sony laptop has a SD memory card slot that I’m hoping to put to use to give me the swapfile I don’t currently have due to using an SSD as the main drive in this computer.  Does this sound like something reasonably doable?  This computer has Linux Mint Cinnamon 19.1 on it.

      • #2345856
        mn–
        AskWoody Lounger

        I expect this should be possible. It probably shows as /dev/mmcblk… something and we’ve got a couple of devices in the house that have swap on a mmcblk device, though only the Raspberry Pi one is removable.

        However, I often find that slotted mmcblk speeds are rather lower than they “should” be… in many computers the card slot is just slow, and reliability problems are common too, either of which would severely hinder using it for swap. Though I suppose if there ever was a brand name that I’d expect good SD-slot performance from, Sony would be it.

        Also the filesystem type of your SD card might be meaningful. Swap to a file on ExFAT or NTFS might not work, and old-style FAT has that file size limit… Linux has no problems with partitions on SD cards so, depends on if you want to use that card with other systems too? I’d probably use a swap partition if not.

        1 user thanked author for this post.
      • #2345863
        Rick Corbett
        AskWoody_MVP
        • A swapfile is continually amended (e.g. reads/writes/integrity checks).
        • SD cards are designed for and better suited to (relatively unchanging) data storage.
        • Even the fastest SD cards have slower read/write speeds than SSD.

        With these in mind, I suggest using the SD card for data and leaving the swapfile on the SSD.

        “Just because you can, doesn’t mean you should” – Ian Malcolm, Jurassic Park

        Hope this helps…

        2 users thanked author for this post.
        • #2345868
          mn–
          AskWoody Lounger

          I suggest using the SD card for data and leaving the swapfile on the SSD.

          That’s almost always the better choice if it’s available.

      • #2345875
        anonymous
        Guest

        The more RAM the better to keep that swap to a minimum and keep those SSD drive’s wear and tear to a minimum. And really any laptop purchase should be for devices that have end user replaceable M.2 drives(NVM/Other) and not and SSD’s that are soldered to the Device’s Motherboard!

      • #2345886
        anonymous
        Guest

        ? says:

        Charlie, i have 4GB ram on a 2007 Acer and don’t ever get into the swap. in fact i built ubuntu 14.04 through 20.04 without a swap partition because they never have gone over 1.5GB. here is a linux mint link which discusses swap:

        https://forums.linuxmint.com/viewtopic.php?t=339459

        and some terminal commands to check what your set-up currently has:

        https://www.digitalocean.com/community/tutorials/how-to-add-swap-space-on-ubuntu-20-04

        1 user thanked author for this post.
      • #2346054
        Charlie
        AskWoody Plus

        Thank you all for the advice and info.  My Sony VAIO only has 2 Gigs of 2007 era RAM and I’m using it without any swapfile or partition.  It does okay but I just thought adding some virtual memory would maybe help it out.

        The main SSD is a Samsung 250 Gig 860 EVO, and I have also read that having a swapfile or partition on an SSD was not a good idea because of heavy reads and writes which put more wear and tear on them, and reduce their life.  If this is not the case then I may as well just set aside some swap space on the SSD.

        I won’t do anything unless I’m sure of what I’m doing.  Learning the proper use of the mkswap command is something I’ll need to know.  The Linux book I have mentions swapon and mkswap, but doesn’t tell how to use them.  Where is the best place to find this out?

        • #2346056
          Microfix
          AskWoody MVP

          Try LinuxJourney under the subheading ‘the filesystem’. In fact that whole website has excellent excersises to try out, certainly helped improve my understanding of how linux works over the years.

          1 user thanked author for this post.
      • #2346163
        EP
        AskWoody_MVP

        If the SD card is at least a “high capacity” card (aka. SDHC) [8Gb of bigger], then maybe you could store the pagefile or swapfile onto the SD card.

        any SD card below 8gigs (ex. 4Gb or less) I would NOT recommend doing such a thing

        1 user thanked author for this post.
      • #2346257
        doriel
        AskWoody Lounger

        From my angle of view, SD card is just too slow for this task. Im not saying it cannot be done, but I would not do that.

        Dell Latitude E6530, Intel Core i5 @ 2.6 GHz, 4GB RAM, W10 1809 Enterprise

        HAL3000, AMD Athlon 200GE @ 3,4 GHz, 8GB RAM, Fedora 29

        1 user thanked author for this post.
    Viewing 7 reply threads

    Please follow the -Lounge Rules- no personal attacks, no swearing, no politics or religion.

    Reply To: Can a swapfile be put on an SD card?

    You can use BBCodes to format your content.
    Your account can't use Advanced BBCodes, they will be stripped before saving.