i deleted my swap partition


  • 1
    Oops 😐
  • 7
    Recreating it is easy. Are you having trouble with it?
  • 0
    yeah, i tried several approaches.
    it's not working
    i'm going to reinstall linux
  • 2
    Should be easy
  • 11
    @amirbig that's... not the way you solve a problem like that
  • 3
    @amirbig Don't solve it as you would in Windows. All you have to do is create a deap partition and put it into fstab from another OS (live USB?) lol
  • 5
    Just create the partition in fdisk, mark it as swap for posterity, do a mkswap and swapon on the device.
  • 9
    “I lost the keys to my car. Oh well, I’ll just buy another car.”
  • 5
    @amirbig Don't reinstall. You can make a new swap partition of any size (generally x1 - x1.5 times of the installed RAM size is what swap size is set to).

    Then you can do 'sudo swapon /dev/sdX' (/dev/sdX being the swap partition) and bam - you got your swap back.

    Next just update your '/etcfstab' you should probably still have the old swap specified here, so kust update that.
  • 3
    Sorry it's '/etc/fstab'.
  • 2
    Recreat flag it like swap
  • 1
    thank you guys for your help ☺️
  • 1
    @theKarlisK so I should set my swap to 16gb if I have 16gb RAM ? Yes I do have it set like that indeed but only because I use the ram.
    Normal people firstly won't need 16gb RAM and second surely not 1x ram for swap. Its usually 0.5x ram size for swap if its larger then 8gb.
  • 0
    @Haxk20 see, this is why it has always confused me - every distro tries to set it to 1:1 or more, no matter how much ram you got... some even refuse to to install if no swap is specified, which I find annoying (I got 32GB RAM... but apparently that's not enough? Wut?).

    Fedora even tried to smuggle in 128GB swap partition when I was trying to set up a test KVM host on an old Intel server once.
  • 1
    @theKarlisK 128Gb ? WTF ? See this is why i set swap manually. Always to half my ram on big RAM. I would even set it to 8Gb with 32Gb RAM.
  • 1
    @theKarlisK if you plan to use hibernation, swap size should be larger than ram size. If no hibernation, a couple gigs should be fine.
  • 0
    @Haxk20 I know right? I usually autocreate the partitions then adjust the size and partitions.

    @electrineer admittedly I haven't encountered a computer which was able to do hibernation successfully. That and most of the computers run on SSDs so if I'm not mistaken, hybernation is unhealty for SSDs.
  • 0
    @theKarlisK With modern SSDs its kind of OK. And @theellectrocioner has a point tho. But I think Linux kernel now hibernates onto a disk if the swap isn't big enough.
  • 0
    My laptop can do hibernation properly BTW. I'm fucking lucky I guess.
Your Job Suck?
Get a Better Job
Add Comment