# Adding swap /hibernation after install

**URL:** <https://forum.endeavouros.com/t/adding-swap-hibernation-after-install/10831>\
**Category:** EndeavourOS installation\
**Created:** [December 30, 2020, 7:07pm UTC](https://forum.endeavouros.com/t/adding-swap-hibernation-after-install/10831 "2020-12-30T19:07:15Z")\
**Posts on this page:** 1\
**Showing post:** 11

<div class="post-metadata">

**Author:** ![joekamprad](https://forum.endeavouros.com/user_avatar/forum.endeavouros.com/joekamprad/32/77608_2.png) [@joekamprad](https://forum.endeavouros.com/u/joekamprad)\
**Post date:** [December 30, 2020, 8:31pm UTC](https://forum.endeavouros.com/t/adding-swap-hibernation-after-install/10831/11 "2020-12-30T20:31:18Z")

</div>

`sudo dd if=/dev/zero of=/swapfile bs=1M count=512 status=progress`  
512 must be changed to the size you want (size of your RAM alike)

```auto
sudo chmod 600 /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile

```

Finally, edit the fstab configuration to add an entry for the swap file:

`sudo nano /etc/fstab`

```auto

/swapfile none swap defaults 0 0

```

simple as this… to get it working for hibernation/suspend:

Add the resume option to grub kernel line  
to the the UUID of the partition containing your `/swapfile`:

```auto
sudo findmnt -no UUID -T /swapfile

```

`sudo nano /etc/default/grub`

```auto
# GRUB boot loader configuration

GRUB_DEFAULT=0
GRUB_TIMEOUT=5
GRUB_DISTRIBUTOR="EndeavourOS"
GRUB_CMDLINE_LINUX_DEFAULT="loglevel=3 resume=UUID= **put the uuid here** nowatchdog"

```

regenerating grub.cfg 🖖  
` sudo grub-mkconfig -o /boot/grub/grub.cfg`

# note:

—\>  
go to the updated wiki page instead it includes also systemd-boot and more:  
[https://discovery.endeavouros.com/storage-and-partitions/adding-swap-after-installation/2021/03/](https://discovery.endeavouros.com/storage-and-partitions/adding-swap-after-installation/2021/03/)

---

_[View the full topic](https://forum.endeavouros.com/t/adding-swap-hibernation-after-install/10831)._
