LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (https://www.linuxquestions.org/questions/slackware-14/)
-   -   Suspend to RAM and acpi events (https://www.linuxquestions.org/questions/slackware-14/suspend-to-ram-and-acpi-events-4175439659/)

narke 12-02-2012 12:31 AM

Suspend to RAM and acpi events
 
Hi,

What's the command to suspend to RAM in slack? And, does anyone know some good sample acpi scripts that can at least monitor my battery status and then trigger something? The default acpi event handler script is too trivial.

Thanks in advance!
woody

allend 12-02-2012 01:21 AM

From /usr/doc/pm-utils-1.4.1/README.SLACKWARE:
Quote:

===============================================================================
PLEASE READ THIS ENTIRE FILE BEFORE REPORTING PROBLEMS OR ASKING FOR HELP!
===============================================================================
Quote:

Assuming they are supported, running "pm-suspend" as root should do a suspend
to ram, and "pm-hibernate" should suspend to disk.
Quote:

Once you confirm that a suspend and resume cycle works as expected, you might
automate the process with some acpi magic, but a better option is to use the
power manager daemon included with your choice of desktop environment (both
kde and xfce have one).
The last quote also applies to battery status.

narke 12-02-2012 06:40 AM

Thanks, pm-suspend works. I did not try pm-hibernate because I don't setup a swap when I installed my slack, now I regret that...

For the GUI daemon, okay, I may consider one of them, you know, I am running fluxbox, before that I still want to try some pure command line via acpi.

Thank you very much!

allend 12-02-2012 07:01 AM

I think that xfce4-power-manager should work quite happily in fluxbox.

You can always set up a swap partition (you may need to resize an existing partition and then create an additional partition first) using 'mkswap'.
You can also use a swap file - see this recent thread. http://www.linuxquestions.org/questi...en-4175439360/

narke 12-02-2012 08:45 AM

Hi Allend,

My largest partition sda7 is a logical partition of type ext4. What command can resize it to give me 4G free? Only after that, I think I can do a mkswap.

Thanks.
woody

beder 12-02-2012 08:53 AM

Quote:

Originally Posted by narke (Post 4841199)
Hi Allend,

My largest partition sda7 is a logical partition of type ext4. What command can resize it to give me 4G free? Only after that, I think I can do a mkswap.

Thanks.
woody

resize2fs and cfdisk, both ship with Slackware

Found a nice enough resource: http://en.positon.org/post/Resize-an...ext4-partition

This is the part you're looking for:
Quote:

To shrink, it's almost as simple:
Code:

# example if you want a 10G partition
# resize filesystem with a size smaller than the desired size
resize2fs /dev/sdxY 9G
cfdisk /dev/sdx
# delete the partition and create it again with the desired size
# (a little bigger than the filesystem!!)
# then launch resize2fs again
resize2fs /dev/sdxY


After shrinking your partition, you'll use cfdisk again to create a swap partition on the now free blocks, and then use mkswap
Then you'll probably have to edit /etc/fstab to include your newly created swap partition (I'm guessing, not sure if mkswap would already write to that?)


ps.: if you google "linux resize partition" most results will want you to use "gparted" (thanks to Ubuntu for using Gnome :-), which off course don't ship with Slackware

tstamp 12-31-2012 09:32 AM

In a related question, is it possible to add the suspend functions to the KDE power management settings?


All times are GMT -5. The time now is 07:04 AM.