2

I had this setup working on my laptop:

/dev/sda1 (ext4) /
/dev/sda2 (ext4) /home
/dev/sda3 swap partition
/dev/sda4 (ntfs) /media/windows

After getting sick of windows, I removed the last partition. Since swap was in the middle, I removed sda3 too and used the space to expand /home so I had to rebuild the swap partition at the end. Now the setup is this:

/dev/sda1 (ext4) /
/dev/sda2 (ext4) /home
/dev/sda3 swap partition

The swap partition works perfectly, it's mounted on boot or manually with swapon an unmounted with swapoff. By the way, I have removed it from /etc/fstab since the laptop has 4GB of RAM and I never use the swap while the system is running. I wrote a little script that mounts the partition before hibernating and unmounts it when the system is recovered from hibernation.The problem is now when I hibernate and boot the system, the boot process doesn't look for data on it. My guess after some tests is that the system doesn't "trust" this new partition and doesn't check for data on it. I guess the UUID has changed?

The weird thing is, if I manually mount the partition with "sudo swapon /dev/sda3" and then I hibernate the system, the data get saved. I know this because when I'm back on the desktop and remount the partition manually, the swapon utility complains that "there's data on this filesystem, cleaning up" (not this exact message, I don't have the laptop right now with me).

Is there a way to force the redetection of this partition as the default hibernation file to look on boot?

EDIT: I just realized that I made a mistake when I rearanged the file system: I gave it only 2 GB instead of 4... So, the partition is not big enough for the 4 RAM in the system. Shouldn't it be still able to hibernate if the memory in use was only 500 MB, which is the case? Or would I need to resize it? If so, can I resize the sda3 partition to make it 2GB smaller? The enlarging process was quite straight forward but I'm not sure if shrink a partition is more dangerous, because involves moving some physical data.

2
  • Yep, it must be greater or equal RAM size (let it strictly greater).

  • Partition shrinking needs to move some data blocks. It's up to you to backup or to take the risk. However, 2GB is considered a short time operation, if it is taken from the end of partition (ie sda2). If it was from the beginning of a large partition (example: sda4), my advice forget it.

  • To fix the hibernation

    1. Get the new UUID

      sudo blkid
      
    2. Update the resume configuration file with the correct UUID

      gksu gedit /etc/initramfs-tools/conf.d/resume
      
    3. Update RAMDisk

      sudo update-initramfs -u
      
    4. Reboot

    Reference: Community Wiki: Swap FAQ

0

Not really sure about that, but i saw that swap partition is mapped on /etc/fstab

# <file system> <mount point>   <type>  <options>       <dump>  <pass>
.... OTHER PARTITIONS
# swap was on /dev/sda3 during installation
UUID=89540d88-4c23-4975-8000-XXXXXXXXXX none            swap    sw              0       0
.... OTHER PARTITIONS

You can get the UUID of the partitions with

ls -l /dev/disk/by-uuid
  • Thanks for your answer but I already tried that. I mapped /dev/sda3 to swap instead of the uuid so it'll have no problems, but doesn't seem to work. And as I said, I don't really mount the swap on boot, only when the system is exiting from hibernation. – animaletdesequia Sep 9 '15 at 23:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.