Why a file as swap can't be used for hibernation in Linux? The 2019 Stack Overflow Developer Survey Results Are InWhy does Linux use a swap partition rather than a file?Can't resume from Suspend / HibernateWhy does resume from hibernation pause/hang?Swap separation for multiple distributionsExtending swap on Centosdebian 8 shutdown dialog change hibernate button methodhow does systemd activate encrypted swap file on alternate partition?Hibernation of a dual boot machine with a shared writable partitionWhy simultaneous use of multiple swap space rather than sequentially, in accordance with the priority?Attributes of Swap PartitionDual-boot Linux & hiberantion: share swap partitionHibernation not working on Linux Mint 19
Dropping list elements from nested list after evaluation
Is it safe to harvest rainwater that fell on solar panels?
Match Roman Numerals
Worn-tile Scrabble
"as much details as you can remember"
Can you cast a spell on someone in the Ethereal Plane, if you are on the Material Plane and have the True Seeing spell active?
Correct punctuation for showing a character's confusion
Why didn't the Event Horizon Telescope team mention Sagittarius A*?
For what reasons would an animal species NOT cross a *horizontal* land bridge?
Is it ok to offer lower paid work as a trial period before negotiating for a full-time job?
Why is this code so slow?
Kerning for subscripts of sigma?
Is bread bad for ducks?
Why doesn't shell automatically fix "useless use of cat"?
How to type a long/em dash `—`
Why not take a picture of a closer black hole?
What is the most efficient way to store a numeric range?
Keeping a retro style to sci-fi spaceships?
Variable with quotation marks "$()"
Are spiders unable to hurt humans, especially very small spiders?
How do you keep chess fun when your opponent constantly beats you?
How much of the clove should I use when using big garlic heads?
Why doesn't UInt have a toDouble()?
Why can't wing-mounted spoilers be used to steepen approaches?
Why a file as swap can't be used for hibernation in Linux?
The 2019 Stack Overflow Developer Survey Results Are InWhy does Linux use a swap partition rather than a file?Can't resume from Suspend / HibernateWhy does resume from hibernation pause/hang?Swap separation for multiple distributionsExtending swap on Centosdebian 8 shutdown dialog change hibernate button methodhow does systemd activate encrypted swap file on alternate partition?Hibernation of a dual boot machine with a shared writable partitionWhy simultaneous use of multiple swap space rather than sequentially, in accordance with the priority?Attributes of Swap PartitionDual-boot Linux & hiberantion: share swap partitionHibernation not working on Linux Mint 19
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
I was trying to hibernate my Fedora 27 system temporarily using a swap
file and failed. Answers in the following question also says that a dedicated swap
partition must be used to hibernate the system and swapfile
can't server the purpose.
Why does Linux use a swap partition rather than a file?
I'm using ext3
file system in which I created the swapfile
. What is stopping the swapfile
to be used for hibernation?
linux swap hibernate
add a comment |
I was trying to hibernate my Fedora 27 system temporarily using a swap
file and failed. Answers in the following question also says that a dedicated swap
partition must be used to hibernate the system and swapfile
can't server the purpose.
Why does Linux use a swap partition rather than a file?
I'm using ext3
file system in which I created the swapfile
. What is stopping the swapfile
to be used for hibernation?
linux swap hibernate
3
kernel.org/doc/Documentation/power/swsusp-and-swap-files.txt
– don_crissti
Mar 28 '18 at 22:39
add a comment |
I was trying to hibernate my Fedora 27 system temporarily using a swap
file and failed. Answers in the following question also says that a dedicated swap
partition must be used to hibernate the system and swapfile
can't server the purpose.
Why does Linux use a swap partition rather than a file?
I'm using ext3
file system in which I created the swapfile
. What is stopping the swapfile
to be used for hibernation?
linux swap hibernate
I was trying to hibernate my Fedora 27 system temporarily using a swap
file and failed. Answers in the following question also says that a dedicated swap
partition must be used to hibernate the system and swapfile
can't server the purpose.
Why does Linux use a swap partition rather than a file?
I'm using ext3
file system in which I created the swapfile
. What is stopping the swapfile
to be used for hibernation?
linux swap hibernate
linux swap hibernate
asked Mar 28 '18 at 21:37
Abhik BoseAbhik Bose
1,5811424
1,5811424
3
kernel.org/doc/Documentation/power/swsusp-and-swap-files.txt
– don_crissti
Mar 28 '18 at 22:39
add a comment |
3
kernel.org/doc/Documentation/power/swsusp-and-swap-files.txt
– don_crissti
Mar 28 '18 at 22:39
3
3
kernel.org/doc/Documentation/power/swsusp-and-swap-files.txt
– don_crissti
Mar 28 '18 at 22:39
kernel.org/doc/Documentation/power/swsusp-and-swap-files.txt
– don_crissti
Mar 28 '18 at 22:39
add a comment |
2 Answers
2
active
oldest
votes
As said here (link provided by @don_crissti), the system must locate the swap file's header, but in order to do this the filesystem that contains the swap file must be mounted, and a journaled filesystem (as ext3 is) cannot be mounted during resume from disk.
Quoting from the document:
In order to use a swap file with swsusp, you need to:
1) Create the swap file and make it active, eg.
# dd if=/dev/zero of=<swap_file_path> bs=1024 count=<swap_file_size_in_k>
# mkswap <swap_file_path>
# swapon <swap_file_path>
2) Use an application that will bmap the swap file with the help of the
FIBMAP ioctl and determine the location of the file's swap header, as the
offset, in<PAGE_SIZE>
units, from the beginning of the partition which
holds the swap file.
3) Add the following parameters to the kernel command line:
resume=<swap_file_partition> resume_offset=<swap_file_offset>
where
<swap_file_partition>
is the partition on which the swap file is located
and<swap_file_offset>
is the offset of the swap header determined by the
application in 2) (of course, this step may be carried out automatically
by the same application that determines the swap file's header offset using the
FIBMAP ioctl)
OR
Use a userland suspend application that will set the partition and offset
with the help of the SNAPSHOT_SET_SWAP_AREA ioctl described in
Documentation/power/userland-swsusp.txt (this is the only method to suspend
to a swap file allowing the resume to be initiated from an initrd or initramfs
image).
add a comment |
You can do this, I've written a big documentation in this SO reply, globally it is working by using uswsusp
and configuring initramfs & Grub correctly.
add a comment |
Your Answer
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "106"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f434177%2fwhy-a-file-as-swap-cant-be-used-for-hibernation-in-linux%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
As said here (link provided by @don_crissti), the system must locate the swap file's header, but in order to do this the filesystem that contains the swap file must be mounted, and a journaled filesystem (as ext3 is) cannot be mounted during resume from disk.
Quoting from the document:
In order to use a swap file with swsusp, you need to:
1) Create the swap file and make it active, eg.
# dd if=/dev/zero of=<swap_file_path> bs=1024 count=<swap_file_size_in_k>
# mkswap <swap_file_path>
# swapon <swap_file_path>
2) Use an application that will bmap the swap file with the help of the
FIBMAP ioctl and determine the location of the file's swap header, as the
offset, in<PAGE_SIZE>
units, from the beginning of the partition which
holds the swap file.
3) Add the following parameters to the kernel command line:
resume=<swap_file_partition> resume_offset=<swap_file_offset>
where
<swap_file_partition>
is the partition on which the swap file is located
and<swap_file_offset>
is the offset of the swap header determined by the
application in 2) (of course, this step may be carried out automatically
by the same application that determines the swap file's header offset using the
FIBMAP ioctl)
OR
Use a userland suspend application that will set the partition and offset
with the help of the SNAPSHOT_SET_SWAP_AREA ioctl described in
Documentation/power/userland-swsusp.txt (this is the only method to suspend
to a swap file allowing the resume to be initiated from an initrd or initramfs
image).
add a comment |
As said here (link provided by @don_crissti), the system must locate the swap file's header, but in order to do this the filesystem that contains the swap file must be mounted, and a journaled filesystem (as ext3 is) cannot be mounted during resume from disk.
Quoting from the document:
In order to use a swap file with swsusp, you need to:
1) Create the swap file and make it active, eg.
# dd if=/dev/zero of=<swap_file_path> bs=1024 count=<swap_file_size_in_k>
# mkswap <swap_file_path>
# swapon <swap_file_path>
2) Use an application that will bmap the swap file with the help of the
FIBMAP ioctl and determine the location of the file's swap header, as the
offset, in<PAGE_SIZE>
units, from the beginning of the partition which
holds the swap file.
3) Add the following parameters to the kernel command line:
resume=<swap_file_partition> resume_offset=<swap_file_offset>
where
<swap_file_partition>
is the partition on which the swap file is located
and<swap_file_offset>
is the offset of the swap header determined by the
application in 2) (of course, this step may be carried out automatically
by the same application that determines the swap file's header offset using the
FIBMAP ioctl)
OR
Use a userland suspend application that will set the partition and offset
with the help of the SNAPSHOT_SET_SWAP_AREA ioctl described in
Documentation/power/userland-swsusp.txt (this is the only method to suspend
to a swap file allowing the resume to be initiated from an initrd or initramfs
image).
add a comment |
As said here (link provided by @don_crissti), the system must locate the swap file's header, but in order to do this the filesystem that contains the swap file must be mounted, and a journaled filesystem (as ext3 is) cannot be mounted during resume from disk.
Quoting from the document:
In order to use a swap file with swsusp, you need to:
1) Create the swap file and make it active, eg.
# dd if=/dev/zero of=<swap_file_path> bs=1024 count=<swap_file_size_in_k>
# mkswap <swap_file_path>
# swapon <swap_file_path>
2) Use an application that will bmap the swap file with the help of the
FIBMAP ioctl and determine the location of the file's swap header, as the
offset, in<PAGE_SIZE>
units, from the beginning of the partition which
holds the swap file.
3) Add the following parameters to the kernel command line:
resume=<swap_file_partition> resume_offset=<swap_file_offset>
where
<swap_file_partition>
is the partition on which the swap file is located
and<swap_file_offset>
is the offset of the swap header determined by the
application in 2) (of course, this step may be carried out automatically
by the same application that determines the swap file's header offset using the
FIBMAP ioctl)
OR
Use a userland suspend application that will set the partition and offset
with the help of the SNAPSHOT_SET_SWAP_AREA ioctl described in
Documentation/power/userland-swsusp.txt (this is the only method to suspend
to a swap file allowing the resume to be initiated from an initrd or initramfs
image).
As said here (link provided by @don_crissti), the system must locate the swap file's header, but in order to do this the filesystem that contains the swap file must be mounted, and a journaled filesystem (as ext3 is) cannot be mounted during resume from disk.
Quoting from the document:
In order to use a swap file with swsusp, you need to:
1) Create the swap file and make it active, eg.
# dd if=/dev/zero of=<swap_file_path> bs=1024 count=<swap_file_size_in_k>
# mkswap <swap_file_path>
# swapon <swap_file_path>
2) Use an application that will bmap the swap file with the help of the
FIBMAP ioctl and determine the location of the file's swap header, as the
offset, in<PAGE_SIZE>
units, from the beginning of the partition which
holds the swap file.
3) Add the following parameters to the kernel command line:
resume=<swap_file_partition> resume_offset=<swap_file_offset>
where
<swap_file_partition>
is the partition on which the swap file is located
and<swap_file_offset>
is the offset of the swap header determined by the
application in 2) (of course, this step may be carried out automatically
by the same application that determines the swap file's header offset using the
FIBMAP ioctl)
OR
Use a userland suspend application that will set the partition and offset
with the help of the SNAPSHOT_SET_SWAP_AREA ioctl described in
Documentation/power/userland-swsusp.txt (this is the only method to suspend
to a swap file allowing the resume to be initiated from an initrd or initramfs
image).
answered Mar 29 '18 at 10:43
dr01dr01
16.3k115475
16.3k115475
add a comment |
add a comment |
You can do this, I've written a big documentation in this SO reply, globally it is working by using uswsusp
and configuring initramfs & Grub correctly.
add a comment |
You can do this, I've written a big documentation in this SO reply, globally it is working by using uswsusp
and configuring initramfs & Grub correctly.
add a comment |
You can do this, I've written a big documentation in this SO reply, globally it is working by using uswsusp
and configuring initramfs & Grub correctly.
You can do this, I've written a big documentation in this SO reply, globally it is working by using uswsusp
and configuring initramfs & Grub correctly.
answered Apr 8 at 13:50
Anthony O.Anthony O.
34538
34538
add a comment |
add a comment |
Thanks for contributing an answer to Unix & Linux Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f434177%2fwhy-a-file-as-swap-cant-be-used-for-hibernation-in-linux%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
3
kernel.org/doc/Documentation/power/swsusp-and-swap-files.txt
– don_crissti
Mar 28 '18 at 22:39