[2024-feb-29] Sad news: Eric Layton aka Nocturnal Slacker aka vtel57 passed away on Feb 26th, shortly after hospitalization. He was one of our Wiki's most prominent admins. He will be missed.
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
howtos:slackware_admin:swapfile_hibernation [2012/12/01 13:31 (UTC)] – [Sources] fl0 | howtos:slackware_admin:swapfile_hibernation [2012/12/01 20:32 (UTC)] (current) – Syntax cleanup sycamorex | ||
---|---|---|---|
Line 2: | Line 2: | ||
====== Hibernation with LVM, LUKS and a Swapfile | ====== Hibernation with LVM, LUKS and a Swapfile | ||
- | With this How To you can use a swapfile | + | With this How To you can use a swap file instead a swap partition as described [[http:// |
- | [[http:// | + | |
- | First create a swapfile: | + | First create a swap file (you can choose another name and / or size if you want): |
dd if=/ | dd if=/ | ||
mkswap / | mkswap / | ||
- | Activate the Swap: | + | Activate the swap: |
swapon /swapfile | swapon /swapfile | ||
- | Check if the Swapfile | + | Check if the swap file is recognized by the system: |
cat / | cat / | ||
Filename | Filename | ||
Line 22: | Line 21: | ||
- | For suspend/ | + | For suspend/ |
- | resume is the partition where the swapfile | + | '' |
- | resume_offset is the beginning of the swapfile | + | '' |
sudo / | sudo / | ||
- | your lilo entry should look like this: | + | Your '' |
# Append any additional kernel parameters: | # Append any additional kernel parameters: | ||
| | ||
- | |||
You need to patch the initrd to recognize the resume_offset parameter | You need to patch the initrd to recognize the resume_offset parameter | ||
+ | <file patch init-swapfile.patch> | ||
+ | --- init.orig | ||
+ | +++ init 2012-12-01 14: | ||
+ | @@ -69,6 +69,7 @@ | ||
+ | | ||
+ | | ||
+ | | ||
+ | +RESOFFSET=$(cat / | ||
+ | | ||
+ | | ||
+ | | ||
+ | @@ -269,18 +270,35 @@ | ||
+ | | ||
+ | rmdir /mountkey 2>/ | ||
+ | fi | ||
+ | - | ||
+ | - # Resume state from swap | ||
+ | - if [ " | ||
+ | - if ls -l $RESUMEDEV | grep -q " | ||
+ | - # | ||
+ | - RESUMEDEV=$(readlink -f $RESUMEDEV) | ||
+ | - fi | ||
+ | - echo " | ||
+ | - RESMAJMIN=$(ls -l $RESUMEDEV | tr , : | awk '{ print $5$6 }') | ||
+ | - echo $RESMAJMIN > / | ||
+ | - fi | ||
+ | - | ||
+ | + | ||
+ | +if [ " | ||
+ | + # be lvm aware | ||
+ | + RESUMEDEV=$(readlink -f ${RESUMEDEV} | awk -F '/' | ||
+ | + if [ -r "/ | ||
+ | + # try sysfs | ||
+ | + read RESMAJMIN < "/ | ||
+ | + elif [ -r "/ | ||
+ | + # otherwise run through / | ||
+ | + while read m n b d jnk ; do | ||
+ | + if [ " | ||
+ | + | ||
+ | + break | ||
+ | + fi | ||
+ | + done < "/ | ||
+ | + fi | ||
+ | + if [ -z " | ||
+ | + # Device does not exist (not found in / | ||
+ | + exit 99 | ||
+ | + fi | ||
+ | + | ||
+ | + if [ -n " | ||
+ | + echo "Try resume from ${RESMAJMIN}: | ||
+ | + echo " | ||
+ | + else | ||
+ | + echo " | ||
+ | + fi | ||
+ | +fi | ||
+ | + | ||
+ | </ | ||
mkdir patched_initrd | mkdir patched_initrd | ||
Line 41: | Line 96: | ||
patch < init-swapfile.patch | patch < init-swapfile.patch | ||
- | after successfull | + | After successful |
find . -print0 | cpio -ov -0 --format=newc | gzip -9 > / | find . -print0 | cpio -ov -0 --format=newc | gzip -9 > / | ||
- | < | + | < |
image = / | image = / | ||
initrd = / | initrd = / | ||
Line 53: | Line 108: | ||
- | then you need to run lilo to save the changes | + | Then you need to run lilo to save the changes |
lilo | lilo | ||
- | after a reboot you can suspend to your swapfile | + | After a reboot you can suspend to your swap file as with your swap partition |
- | < | + | < |
====== Sources ====== | ====== Sources ====== | ||
- | * Arch Linux Wiki: [[https:// | + | |
- | * Originally written by [[wiki: | + | * [[https:// |
+ | |||
+ | |||
+ | | ||
<!-- If you are copying information from another source, then specify that source --> | <!-- If you are copying information from another source, then specify that source --> |