#Ruined something while trying to switch Zram with Swap

25 messages · Page 1 of 1 (latest)

supple pecan
#

So i was following this Gemini prompt (bad idea) to replace my Zram of 4 gigs to a Swap partition of 10 gigs so i could enable hibernation... But after a restart i ended up in good-ol emergency mode. Here are the steps i followed and some images. Would really appreciate some help here.

Gemini Prompt:

Here's how to switch from Zram to a swap partition of 10 GB on your Linux system:

1. Disable Zram (if currently active):

  • Check if Zram is active with swapon -s. If it shows a device like /dev/zram0, proceed to disable it.
  • Use the following command to disable Zram:
swapoff /dev/zram0

2. Create a Swap Partition:

  • Identify a free disk using fdisk -l.
  • Warning: Using fdisk can potentially damage your data if done incorrectly. Proceed with caution and consider backing up your important data before continuing.
  • Use fdisk to create a new partition on the chosen disk. Refer to the fdisk man page (man fdisk) for detailed instructions. During partition creation, ensure you select the type of partition as Linux swap (usually code 82).
  • Once the partition is created, format it for swap usage with the following command (replace /dev/sdX with your actual partition device name):
swapon /dev/sdX

:

#

3. Configure Swap Partition in fstab (Optional):

  • Editing /etc/fstab requires root privileges. Use a text editor like nano with root permissions (sudo nano /etc/fstab).
  • Locate any existing swap entries (lines starting with /dev/zram or other swap devices). Comment them out by adding a # symbol at the beginning of the line.
  • Add a new line to /etc/fstab for your newly created swap partition. The format is:
/dev/sdX  none  swap  defaults  0 0

Replace /dev/sdX with your actual partition device name.

4. Reboot (Optional):

  • While the changes should take effect immediately, a reboot can ensure everything is loaded correctly.

Here are some additional points to consider:

  • After disabling Zram and creating the swap partition, verify it's active with swapon -s. The output should show your new swap partition.
  • You can check the size of your swap partition with df -h /dev/sdX (replace /dev/sdX with your partition device name).
  • Using a swap partition can cause performance degradation compared to Zram, especially during heavy swap usage. Consider if 10 GB is sufficient for your swap needs.

If you encounter any issues during the process, consult your distribution's documentation or seek help on Linux forums.

#

What I ended up with :

devout rover
#

whats your lsblk

#

preferably -o +UUID

wet sun
#

@supple pecan

supple pecan
# wet sun <@763618128592240640>

Saved my configs/data and did a reset on pc due to urgency. But I guess the reason behind it was corruption in my /home directory

#

That failed file system check says it, should've taken a closer look instead of panicking ig lmao

And I would be going with a swap file this time, that's probably much easier to setup with minimal demerits

wet sun
#

@devout rover

void karma
#

you still up?

#

okay, you're approaching this all on the wrong angle and gemini got a lot wrong

wet sun
#

@supple pecan

supple pecan
void karma
#

okay, just to be clear here zram is not swap, and you don't "switch" as in replace, you can have both
and tbh just use a swapfile instead of swap partition

#

anyways, show me lsblk -f

#

and for hibernation, you need just a swap space, you need not mount it as system swap
in fact it's better if you don't mount the swap space for hibernation as system swap

#

@supple pecan

supple pecan
wet sun
#

@void karma

void karma
#

Oh you are booted now it seems

#

Okay so you don't have either zram or a swap space to hibernate to rn

#

so here's the outline:

  • setup zram
  • setup swapfile
    • DO NOT mount the swapfile as swap, better this way for hibernation
    • you can totally mount a differetn swapfile as swap though
  • get physical offset of swapfile to use for hibernation resume_offset= kernel cmd
abstract escarp
#

Is swap partition not good to use with zram, as i am not able to configure encrypted swap file to use with zram