hibernate not working on 10.10

Asked by raj on 2010-10-26

i have a dell mini 9 netbook with a 8GB HDD. i have installed ubuntu 10.10 and everything works very nicely except for the hibernate.

It comes up with a message saying swap size not large enough (i have 4GB of space free and mainly use it for surfing the web so would really like hibernate to work even if it used up most of the free space)

how can i fix this or get hibernate to work properly?

thanks

Question information

Language:
English Edit question
Status:
Answered
For:
Ubuntu Edit question
Assignee:
No assignee Edit question
Last query:
2010-11-04
Last reply:
2010-11-04

Can you give the output of:

free -m; df -h

Thanks

Jim Bauwens (jimbauwens) said : #2

Your 8gb HDD is probably a SSD (solid state disk) and because most ssd of that size are really crap, its not a good idea to hibernate to it (it can actually be bad for the ssd). The best is just to suspend (to ram), and if you want to save power just shut it down.

Jim

raj (random-901) said : #3

output is:
             total used free shared buffers cached
Mem: 991 881 109 0 90 480
-/+ buffers/cache: 310 681
Swap: 363 0 363
Filesystem Size Used Avail Use% Mounted on
/dev/sda1 6.7G 2.4G 4.1G 37% /
none 491M 252K 491M 1% /dev
none 496M 656K 496M 1% /dev/shm
none 496M 88K 496M 1% /var/run
none 496M 0 496M 0% /var/lock
none 6.7G 2.4G 4.1G 37% /var/lib/ureadahead/debugfs
/dev/mmcblk0p1 15G 8.0K 15G 1% /media/RAJAN 16GB

Jim:
it is a SSD but it is NOT bad for it and have never heard of anyone causing them damage when using them to hibernate. i need to hibernate as i have lots of things open when i am working so can not shut down and if i leave it for a day or 2 the suspend/sleep kills the battery.

thanks :)

Jim Bauwens (jimbauwens) said : #4

I can see that you only have 363mb of swap space.
When you hibernate, the content of your memory (which is 1gb) is copied to the swap. But since you only have a 363 swap partiton, it will not work.
So, you need to add more swap :

Create a 1,5 GB image :
sudo dd if=/dev/zero of=/mnt/1536Mb.swap bs=1M count=1536

Format it for swap:
sudo mkswap /mnt/1536Mb.swap

Edit /etc/ftab:
sudo gedit /etc/fstab

Add this line at the end of the file:
/mnt/1536b.swap none swap sw 0 0

Save. After the next reboot the swap will be used automatically.
Try to hibernate, and if it works, thank Linux :)

Jim Bauwens (jimbauwens) said : #5

Don't forget that this will use 1,5 GB of your system.

Yes it is, SSD has a limited number of write cycles and the hibernate stuff is written to the drive EVERY time you hibernate, this makes the drive take an absolute hammering as you will write 1Gb to the drive every time you hibernate. This will significantly reduce the life of the device.

You have 1Gb of RAM but on 363Mb for swap which is not enough, you should have 2Gb as you have less than 2gb RAM and the rule of thumb states 2xRAM for less than 2Gb system RAM.

I also suggest you set vm.swappiness to 0 to reduce further writes to your drive and use ext2 for the partitions on the drive. These extra steps will prolong the life of the drive as ext4 and ext3 have a journal which is updated a LOT and will use the limited write cycles of the drive.

Jim Bauwens (jimbauwens) said : #7

Actionparsnip : You can disable the journal on a ext4 drive, but it might be even better to use btrfs, because it has builtin ssd performance options.

True, according to http://kernelnewbies.org/Ext4 it actually adds a small performance improvement. This is VERY advised on SSDs

raj (random-901) said : #9

i done as you said above, but i comes up with a message saying 57MB not enough swap and then the screen just goes blank with it still on :s

Jim Bauwens (jimbauwens) said : #10

And, to go even further, you could add noatime and nodiratime to the mount options of your drive.
It then will not write the last accessed time, which will speed file access.

Jim Bauwens (jimbauwens) said : #11

There is a mistake in one of my posts :

Add this line at the end of the file:
/mnt/1536b.swap none swap sw 0 0

should be

Add this line at the end of the file:
/mnt/1536Mb.swap none swap sw 0 0

Jim Bauwens (jimbauwens) said : #12

Sorry raj ,didn't see your post.
Maybe because of my mistake (see above message)
or, if that doesn't help, you have to make you swap partition bigger:

sudo swapoff /mnt/1536Mb.swap
sudo rm /mnt/1536Mb.swap
sudo dd if=/dev/zero of=/mnt/1536Mb.swap bs=1M count=2048

Reboot, and try.

raj (random-901) said : #13

nope, still not working :(
if it helps the output is now :
             total used free shared buffers cached
Mem: 991 545 446 0 45 296
-/+ buffers/cache: 203 787
Swap: 363 0 363
Filesystem Size Used Avail Use% Mounted on
/dev/sda1 6.7G 4.4G 2.1G 68% /
none 491M 252K 491M 1% /dev
none 496M 112K 496M 1% /dev/shm
none 496M 120K 496M 1% /var/run
none 496M 0 496M 0% /var/lock
/dev/mmcblk0p1 15G 8.0K 15G 1% /media/RAJAN 16GB

thanks

Jim Bauwens (jimbauwens) said : #14

Could you post the content of /etc/fstab?
cat /etc/fstab

Jim

Personally I'd reinstall. You have made some REALLY bad choices for your system. Use 2Gb swap and make the partitions use ext2 and you will be fine.

Jim Bauwens (jimbauwens) said : #16

I think that ubuntu chose it for him, and if i had the choice, I would not use a swap partition (but then you cannot hibernate).
And there is no reason for him to reinstall, he can just disable the journal on his ext4 partition.

raj:
Change the last line of /etc/fstab (the line that you added) to :
/mnt/1536Mb.swap swap swap defaults 0 0
and reboot. Try to hibernate.

If that does not work, check if /mnt/1536Mb.swap exists, if it doesn't run the command
sudo dd if=/dev/zero of=/mnt/1536Mb.swap bs=1M count=2048
and reboot

Jim

raj (random-901) said : #17

still doesn't work, i did not have a choice on install. i chose every option i could but it wasn't one of them.

# /etc/fstab: static file system information.
#
# Use 'blkid -o value -s UUID' to print the universally unique identifier
# for a device; this may be used with UUID= as a more robust way to name
# devices that works even if disks are added and removed. See fstab(5).
#
# <file system> <mount point> <type> <options> <dump> <pass>
proc /proc proc nodev,noexec,nosuid 0 0
# / was on /dev/sda1 during installation
UUID=71cbbc50-7788-4092-b3b8-955d26d9ad03 / ext4 errors=remount-ro 0 1
# swap was on /dev/sda5 during installation
UUID=056a47e9-e934-47f1-bf75-d5a3aa79bfd5 none swap sw 0 0
/mnt/1536Mb.swap swap swap defaults 0 0

i ran the other command and it came up with:
rajan@rajan-Inspiron-910:~$ sudo dd if=/dev/zero of=/mnt/1536Mb.swap bs=1M count=2048
dd: opening `/mnt/1536Mb.swap': Text file busy
rajan@rajan-Inspiron-910:~$

what should i do now?

Jim Bauwens (jimbauwens) said : #18

You can only choose you swap settings if you do a manual install. (but normally to add swap you don't have to reinstall)

Try:
sudo swapoff /mnt/1536Mb.swap
sudo rm /mnt/1536Mb.swap
sudo dd if=/dev/zero of=/mnt/1536Mb.swap bs=1M count=2048
And ... change again the last line :in /etc/fstab

/mnt/1536Mb.swap none swap sw 0 0

reboot and try to hibernate.
If this doesn't work, and you are realy in need to hibernate, then reinstall (make sure you have all your data on your SD card, and don't leave the SD card in you compter during the install), and select the option manual formating (or something like that).
Remove all the partitions.
Create a partition of 6GB (ext4,ext2,btfrs or whatever you choose) with / as mountpoint and a 2GB partition as swap.
When its done, reboot and try to hibernate, if it doesn't, don't blame me, its your computer :)

Can you help with this problem?

Provide an answer of your own, or ask raj for more information if necessary.

To post a message you must log in.