How to mount and use swap partition _only_ for hibernation ?

By "hibernation" I mean suspend to disk.
My disk is a bit poor in RAM and the dirsk is slow, so I want to prevent any swap use of my system.
AND I want to use hibernation, in order to boot fatser... and not to loose my workspace state.
With a swap partition, hibernation works nicely.
But any intensive web browser easily lealds to incresed memory usage, hence swap use.
I have lowered the swap priority in /etc/fstab, down to 1 (and even tried 0).
Still, I am not satisfied : If would like not to use swap at all but for hibernation.
My plan was hence :
1) disable the automatic swap mount at boot
2) add a systemd unit to only moutn before hibernation
The first part was easy : I added a "noauto" option in /etc/fstab. Great, no more mounted swap. But, as expected, no more successful hibernation.
Then I tried to create a custom systemd unit.
- first copy the unit file automatically generated by systemd in /run/systemd/generator/dev-....swap to /etc/systemd/system/
- and add "Before=sleep.target" line in the Unit section
Result file here :
> cat /etc/systemd/system/dev-disk-by\x2duuid-blablablabla.swap
[Unit]
Description=Swap required for hibernation
Before=sleep.target
[Swap]
What=/dev/disk/by-uuid/blablablablabla
Priority=5
>
Next step show be to enable it, but I first run a safety check :
> systemctl show dev-disk-by\x2duuid-blablablabla.swap
Id=dev-disk-by\x2duuid-blablablabla.swap
Names=dev-disk-by\x2duuid-blablablabla.swap
Requires=-.mount
Wants=system.slice
BindsTo=dev-disk-by\x2duuid-blablablabla.device
RequiredBy=swap.target
WantedBy=dev-disk-by\x2duuid-blablablabla.device
Conflicts=umount.target
Before=sleep.target umount.target swap.target
After=systemd-journald.socket dev-disk-by\x2duuid-blablablabla.device system.slice -.mount
RequiresMountsFor=/dev/disk/by-uuid/blablablabla
Description=Swap required for hibernation
LoadState=loaded
ActiveState=inactive
SubState=dead
FragmentPath=/etc/systemd/system/dev-disk-by\x2duuid-blablablabla.swap
UnitFileState=static
InactiveExitTimestampMonotonic=0
ActiveEnterTimestampMonotonic=0
ActiveExitTimestampMonotonic=0
InactiveEnterTimestampMonotonic=0
CanStart=yes
CanStop=yes
CanReload=no
CanIsolate=no
StopWhenUnneeded=no
RefuseManualStart=no
RefuseManualStop=no
AllowIsolate=no
DefaultDependencies=yes
>
The problem here is that, somehow, a RequiredBy=swap.target line is apaprently automatically added, and makes exactly NOT what I want.
I've been battling a bit with systemd, but so far I have no clue how to do this correctly.
Important : I wand a clean "official" way, not to do a "service" unit that calls an home-brewed script taht calls swapon. I can do that, but systemd should be able to do it better than me, and without any trick.

Hello and thank you all
@fdservices & @WonderWoofy :
In fact, I forgot to mentionned swappiness, just tought about mentionneing the swap priority which act at a very different level is only revelevant when you ahve several swap files.
I have already modified that setting since quite a long time... and it indeed makes the system behaviour so much better.
Honestly, I could do with it... that's what I am doing since a few months in fact, and it really largely improved the user experience.
Still, the setting only makes swapping unlikely, but does not forbid it.
@WonderWoofy & @lucke :
You may be right, I could satisfy with swapiness...
Still, my feeling is that swap at run-time is mostly a remeniscence of the time where having several megabytes of RAM was juste a fantasm. At that time, at least for some intensive operations, simulating more RAM thansk to the cheaper & slower disk capacity was really decisive for a good user experience... and to allow some operations like some huge compilations. My feeling is that today, with our Gigabytes of RAM on our desktop/laptop, the need is much lower. In fact a swap is probably counter-productive for SSD for example (fast, yes, but swap is by nature something you write quite often, reducing teh SSD lifetime significantly). And simulating extra RAM is also counter-productive with applications such as web browsers which handle large amount of memory to handle cache themselves; it causes memory pressure, hence trigger swapping and machien slowdown instead of trigerring their pseudo-smart memory cleaning mechanisms. Last but not least, it does not encourage any improvement on application memory needs and rationalisation.
In fact, unless when I compile huge programs, or on really-limited-memory (embedded) systems, or eventually if swap can be hosted on significantly faster-than-storage disks, I feel that swapping does not really improve the user experience and system performance... and in contrary reduces them by having to handle swapping on and off memory & cache pages.
SO that's why I want to try. It's OK if I fail, swappinees fixes most my user experience issue, but I try to solve my more "theorical" issue as well.
And honestly, it is also to lean & play a bit with systemd as well.
More to come, I have things partially working now. Partially for now, and maybe perfectly with your help ?

Similar Messages

  • How to install and use a client certificate for use with https sites on Android?

    I need to be able to install a .p12 client side certificate to be sent to the admin section of my company's site to authenticate me as an employee. In FireFox for PC there is the ability to install this client certificate. In the mobile I cannot figure out how to get this to work.
    I just bought an Asus Transformer Android Tablet running Honeycomb. I have tried the following method below:
    http://support.mozilla.com/en-US/questions/786035
    I get to the screen where I am able to present and choose a certificate but I still get the (Error code: ssl_error_handshake_failure_alert).
    Now that Android is really picking up steam, there needs to be a way to install client side certificates to present to sites requesting them.
    Is there another way to hack the system to allow or install a client side certificate in .p12 format?

    Sorry, there's not a good way to install client certificates in Firefox 4 for Android. A bug has been filed, and any work that we do on adding this feature will be tracked here:
    https://bugzilla.mozilla.org/show_bug.cgi?id=478938

  • How to copy and use the RAID files for ATI SB600 for a new build

    WinXP Home
    MSI K9A Platinum
    AMD Athlon X2-3600+
    2 x Seagate 250GB SATA2 3GB/s HHD
    2 x HIS X1950Pro in Crossfire
    2 x OCZ2A8002GK Crossfire certified modules
    Enermax Galaxy 850
    Hello, I plan on setting this new build up with SATA RAID 0. I tried to follow the ReadMe file in the RAID drivers download but think I am not fully understanding. The ReadMe says to copy all files to the media...it said floppy but I am going to use a flash drive. I did so but there were two folders, X64 and  X86. Do I open those two folders and copy all the contents or do I just copy the two folders directly to the drive?
    Thank you

    Quote from: lewislink on 05-July-07, 02:13:43
    Open the sub-folders and copy their contents, or copy the sub-folders, themselves?
    What about BIOS update? Will it be necessary to use a floppy or can a flash drive function?
    "What about BIOS update? Will it be necessary to use a floppy or can a flash drive function?"
    don't update the BIOS when everythink is working...
    "Open the sub-folders and copy their contents, or copy the sub-folders, themselves?"
    copy them as is.. directly with sub-folders included.

  • I used a partitioned HDD for time machine, using a partition already containing other data files. I am now no longer able to view that partition in Finder. Disk Utility shows it in grey and "not mounted". Any suggestions of how to access the files?

    I used a partitioned HDD for time machine, using a partition already containing other data files. I am now no longer able to view that partition in Finder. Disk Utility shows it in grey and "not mounted". Any suggestions of how to access the files? Does using time machine mean that that partition is no longer able to be used as it used to be?
    HDD is a Toshiba 1TB, partitioned into two 500GB partitions.
    OS X version 10.9.2

    Yes, sharing a TM disk is a bad idea, and disks are cheap enough so that you don't need to.
    Now
    Have you tried to repair the disk yet

  • How do I create 2 Recovery partitions: one for Lion and one for Mountain Lion?

    Well that is basically the question:
    How do I create 2 recovery partitions: one for Lion and one for Mountain Lion?
    Reason is that I would like to keep the option to return to Lion, or even better, have a seperate partition for eacht?

    can I access my programs from the other partition, so I can save space ...
    No, as far as I know, each one is completely separate - especially if you're dealing with two different versions of OS's.
    is it possible to safely make an extra partion on a running drive (it is my main computer ...) The disk is large enough ...
    how large would this have to be
    I've personally never done it on a running drive - have read it's possible, but don't want to suggest it since I've never done it and wouldn't be sure about the steps. This is how I got to two partitions on my iMac:
    Originally, I had just one partition with Snow Leopard. I used CCC to clone that to an external drive. Booted into that drive and used DU to partition and erase the internal. I then cloned the new clone back. Also cloned the same thing to the other partition which I then upgraded to Lion. So I had two OS's - SL and Lion. I've now decided to clone my SL to an external drive for occasional use and installed ML on that partition - so now I have Lion and ML.
    There are two ways to get a "fresh" install: either download the OS again and install it on a partition of your choice or, as I've done as well, copy the installer to a safe place so you don't need to download it again. It does include whatever apps/software is included in the OS.  I've designated two smaller partitions on externals as my "fresh" installs of both Lion and ML for emergency or reinstall purposes (this is my way of dealing with not having install DVDs) - I took the time to install it there and then slowly add fresh installs of my important apps (either via download or install CD) - don't bother with the little/less used stuff, a current copy of that can be downloaded if and when I need it. I don't really update those two - that can also be done if/when I need it since that'll always change.
    So, yesterday, I decided I wanted to start fresh with ML - booted into my fresh install of Lion (on external), wiped the SL partition on my internal and installed Lion. Decided to download a fresh copy of the ML installer and installed that. Then ran Software Update. After that, repaired permissions. Then I methodically opened every third party app and checked for updates - installed those where necessary. After all that, I simply copied (drag 'n drop) my entire Documents folder (which contains all my important data,, photos, etc) over from another backup.
    This took a while, but mostly because of the long download times; the installs weren't all that bad. I should be running a really clean system now, especially since nothing was ported over except my Documents folder.

  • I have an iPad 2 and used old Apple ID for iBook app; now it wants to upgrade but I have a new Apple ID, how can I make certain I don't lose any data in my iBooks?

    I have an iPad 2 and used old Apple ID for iBook app; now it wants to upgrade iBook but it is "stuck" on my old ID, yet I already created a new ID but it won't let me update the App.  I have everything backed up on my MacBook so if I delete iBooks on my iPad and retrieve the App under my new ID and then sync with my MacBook, will I still have all of the books, etc.?

    Your purchases are tied to your Apple ID. If you bought all of the books with the old ID then AFAIK you will have to continue to use that ID in order to continue to sync those books to the iPad.
    You have to update the app with the old ID so I don't see how you could keep the books with the new ID. Maybe I am wrong about this, but someone else will chime in I'm sure and correct me if I am wrong.

  • How to Set and Use a global variable within a session?

    Dear All,
    I'm new to jsp, and would like to ask how to set and use a global variable within a session?
    Thanks in advance.
    Regards,
    Cecil

    With session.setAttribute("name",object) you can store a Attribute in the session object.
    with session.getAttribute("name") you can get it.
    That's it.
    Regards,
    Geri

  • How to install and use a plug-in downloaded from the apple site?

    how to install and use a plug-in downloaded from the apple site?

    Emelie,
    which plug-in do you want to install?
    some of the plug-ins come with an installer on the disk image, you click the installer and it will install it in its proper location.
    For others you move the plug-in into to System Library or your User Library:
      Your Hard disk  > Library > Application Support >Aperture > Plug-Ins > Edit
    or
    Your Home Folder > Library > Application Support >Aperture > Plug-Ins > Edit
    If it is an "Edit" plug-in, it goes into the "Edit" subfolder, "Export" plug-ins into the "Export" subfolder.
    You can tell by the extension, what kind of plug-in it is.
    E.G. BorderFX.ApertureExport is an export plug-in, BorderFXEditPlugin.ApertureEdit an edit plug-in.
    Regards
    Léonie
    P.S. In OS Lion the Libraries are hidden by default: To reveal your User Library activate the Finder and select from the main Finder menu:
        Finder >  Go , then hold down the ⌥-option-key, untill the Library appears in the drop.down menu.
    To show the System Library:
         Finder >  Go > Go to Folder
    then enter   / Library

  • How to create and use mutable array of UInt8

    Hello!
    If I get it right, UInt8 *buffer, buffer - is a pointer to a start of array?
    Then how to create and use mutable array of UInt8 pointers?
    The main target is a creation of the module that will store some byte array requests and will send all of them at the propriate moment.

    I try
    - (void) scheduleRequest:(UInt8 *)request {
    if (!scheduledRequests) scheduledRequests = [[NSMutableArray array] retain];
    [scheduledRequests addObject:request];
    But get warning:"passing argument 1 of 'addObject:' from incompatible pointer type"

  • HOW TO CREATE  and  USE EVENTS IN WORKFLOWS .

    HOW TO CREATE  and  USE EVENTS IN WORKFLOWS with the help of classes.
    What i am doing is..
    open se24
    event tab->event name->parameters
    method tab->method name->event handler->copy parameters
    interface tab->if_workflow->enter
    tell me what else to do step by step
    Another important thing is that HOW to use these class events to trigger the workflows.
    REPLY ASAP
    THXS IN ADVANCE

    Hi,
    Pl. see this blog...
    Raising ABAP OO events for workflow
    Regards,
    JOy.

  • How to Create  and use of Coherence servers in weblogic serevr 11g (10.3.6)?

    how to Create  and use of Coherence servers in weblogic serevr 11g (10.3.6)?

    See the below discussion
    How to create and use Webservice controls using WSDL in weblogic portal10.3
    Thanks,
    Venkat Sarvabatla

  • How to create and use dynamic queue in JMS

    Plz tell me how to create and use a dynamic queue in jms and can reciever file lookup it as it lookup any server configurred queue(written in the server).

    Hi,
    We can use Azure File services to do this, for more information, please have a look at this article:
    http://blogs.msdn.com/b/windowsazurestorage/archive/2014/05/12/introducing-microsoft-azure-file-service.aspx. The Azure File service exposes file shares using the standard SMB 2.1 protocol. Applications running in Azure can now easily share files between
    VMs using standard and familiar file system APIs like ReadFile and WriteFile.
    Best Regards,
    Jambor
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • Could you let me know how to enable and use ITS on SAP ECC5  and ECC6

    Could you let me know how to enable and use ITS on SAP ECC5  and ECC6

    Hello Tina,
    please see here
    in tree select "Installation and Activation"
    <a href="http://help.sap.com/saphelp_nw70/helpdata/en/4f/2e6a52c3cdc44d83169b181a9c62ba/frameset.htm">http://help.sap.com/saphelp_nw70/helpdata/en/4f/2e6a52c3cdc44d83169b181a9c62ba/frameset.htm</a>
    <a href="http://help.sap.com/saphelp_nw70/helpdata/en/b8/2a8d65be7eee4eb66067f8a33d1c8b/frameset.htm">http://help.sap.com/saphelp_nw70/helpdata/en/b8/2a8d65be7eee4eb66067f8a33d1c8b/frameset.htm</a>
    best regards

  • Hello guys..does anybody know how to install and use adobe master collection with the new lion?   I need to use Flash and illustratore, but apparently those programmes are incompatible with the new operative sistem...   I am a new mac users and I'd like t

    Hello guys..does anybody know how to install and use adobe master collection with the new lion?
    I need to use Flash and illustratore, but apparently those programmes are incompatible with the new operative sistem...
    I am a new mac users and I'd like to know if there are other similar programmes I can use with lion!

    Lab79 wrote:
    Are you on Apple's payroll?
    well dude I can only let you know that as I work with those programme I don't have to pay for it is my company that pays the programme I whant to use( that's why I was asking if there where other programmes ..that I could use with lion insted that Illustrator and Flash!)..I know Adobe since 2005 and I can say that Adobs products are very good...I think that if it's an Adobe probleme or fault ..they will solve it very soon...but unfortunally I have the impression that after Jobs passed away Appel decided to change politics..and everything started to go very bad! (see FCP X)..
    good luck with apple dude..
    Where is the Apple problem? I have CS4 and CS5 running perfectly fine on my Macbook Pro. Installed 5 after Lion upgrade. Worth every cent. Adobe did have some catching up to do with Lion but with the CS5.5 update all runs fine. But not yours. So it is a problem with the Lion OS? You say you have been with Adobe since 2005. So you would be aware of all the other issues that Adobe had catching up with past Oss in Mac and Windows then. They get it right, but it is up to them. It is not up to Apple, nor Microsoft for that matter, to run around and check that every software developer in the world is running their business properly.
    And what has politics got to do with anything. Some people just have to blame Software for their poor Hardware maintainence of failure of the same.
    <The only think I can really do is to go back on my old windows...give back this orrible lap top and ask for my money back!>
    Great suggestion. You should go with that one, but good luck getting a refund.
    Bye

  • Need help how to install and use html db

    plz any body can help me i have download htmldb2.0 and want to install and use it with oracle but i do not know how to install and use it first time any body can help me in detail .
    Niazi

    Niazi,
    Included in the 2.0 download are some very comprehensive Installation and Upgrade instructions, I would highly recommend you read those.

Maybe you are looking for