Swap partition VS Swap File system

Hi everyone!!
I am using Oracle 11g (enterprise edition) on linux redhat 5.5 . At present, we have 12G RAM and swap partition of 2G. I know that we should have swap area of 6GB as per RAM. But we are unable to create new swap partition or resize existing. So I want to know is should I create new swap file of 4Gb that can be used as swap area in addition to existing swap partition of 2Gb. So that total swap area will be of 6G
( 2G swap space + 4G swap file).
1. Will it be meaningful or not ?
2. Which one is better among swap partition and swap file ?
3. Will swap file cause performance  degradation due to incompatibility between them ?
Thanks & Regards
Tushar Lapani

This is a 100 percent Unix question and has nothing to with Oracle RDBMS.
Please close this question here and post it in any Unix forum.
Sybrand Bakker
Senior Oracle DBA

Similar Messages

  • Swap Partition Vs Swap file

    Hi everyone!!
    I am using Oracle 11g (enterprise edition) on linux redhat 5.5 . At present, we have 12G RAM and swap partition of 2G. I know that we should have swap area of 6GB as per RAM. But we are unable to create new swap partition or resize existing. So I want to know is should I create new swap file of 4Gb that can be used as swap area in addition to existing swap partition of 2Gb. So that total swap area will be of 6G
    ( 2G swap space + 4G swap file).
    1. Will it be meaningful or not ?
    2. Which one is better among swap partition and swap file ?
    3. Will swap file cause performance  degradation due to incompatibility between them ?
    Thanks & Regards
    Tushar Lapani

    Swap is no substitute for RAM. It provides a fail-safe mechanism and allows the kernel to handle active memory allocation more efficiently.
    Your requirement or conclusion about swap space may or may not be reasonable, depending on your desired configuration. As a rule of thumb, swap space is usually configured twice the RAM if you use 8 GB or less and equal the amount of RAM if you have 16 GB or more. If you have 64 GB of RAM, it does however not make sense to have 64 GB of swap space, because the performance degration should you ever need that much swap space will be very bad.
    A swap file as opposed to a swap partition has some security and safety concerns, and some performance overhead because of using a file system, but it can be feasible. It depends on your I/O use and hardware.
    However, you will probably want to configure your Oracle database to use kernel Hugepages using ASMM instead of AMM for best performance and efficient memory use. Kernel Hugepages, unlike POSIX shared memory (/dev/shm) used by AMM, will be pre-allocated at system startup and cannot use swap space.
    Message was edited by: Dude!
    Until kernel 2.4 it was considered that a swap partition is faster than a file, but with the improvements of kernel 2.6, the performances is almost the same. A swap file has the advantage that it can be easier re-sized or removed than a swap partition, but it can get fragmented or deleted by accident. For best performance it should also be located at the outer parts (beginning) of the disk.

  • Missing Recovery Partition and Unrecognized File Systems

    So, a long time ago I accidentally deleted my recovery partition and have recently been trying to fix it so that I can upgrade my OS to Mavericks. After browsing around here I found the Recovery Partition Creator 3.7 and used it to create a new recovery partition. Using the diskutil list command everything seemed to be fine and it looked like the partition was successfully created so I tried reinstalling OS X Lion by holding command R at startup. Doing so brought up the internet recovery menu and I selected reinstall Lion which was still unsuccessful because "a recovery partition could not be created". So, I decided to check in disk utility to see what might be wrong and I used the disk utility debug command in order to access disk utility's debug menu and show all the hidden partitions. Now, looking at these partitions I see two hidden partitions: disk0s1 which is an EFI partition, and disk0s3 which is the Apple Boot Partition that was created by Recovery Partition Creator 3.7. After verifying the partitions, disk utility is telling me that both my EFI and apple boot partitions have unrecognized file systems, my Macintosh HD partition is fine. At this point I do not know what to do.
    Below are photos of the diskutil list and of what disk utility is showing me for the two hidden partitions.
    For reference I am running OSX Lion 10.7.5 (11G63) on a early 2011 13 inch Macbook Pro (Base Model).
    Bootrom version: MBP81.0047.B27
    SMC Version: 1.68f99
    Thank you all in advance for your help, feel free to ask me any questions.

    Just an update, I went ahead and installed Lion again over the existing TM restored installation using the Lion Update file and at least File Vault is working. Interestingly, I still do not have a Recover partition so obviously something new for Apple Support to learn.

  • When i was partitioning my hard drive i ran out of power (so it closed in the middle of the process). now when i try to partition it says Couldn't modify partition map because file system verification failed.

    When i was partitioning my hard drive i ran out of power (so it closed in the middle of the process). now when i try to partition it says Couldn’t modify partition map because file system verification failed.

    You'll have to select the entire external hard drive by the hardware name itself and then apply a new partition table to it under the Partition tab of Disk Utility. Erase and format the drive.
    GUID for OS X.

  • During Windows install, says the Bootcamp Windows partition is incorrect file system and won't install

    I had another Macbook Pro retina which I installed Windows 8 on with no problems via bootcamp.  I just updated to the late 2013 model of the Macbook Pro, and attempted to do the same thing but have had problems.  I create the partition for Windows with Bootcamp, restart the computer, and after I enter my security key in the Windows installation screen it comes to the screen where you have to select the appropriate installation drive.  When I select the drive I created for Windows, it says that it can't install due to the file system.  I have no idea why I'm having this problem because I had done this once before....I can't for the life of me figure out what's wrong and I'm at a loss.
    If anyone can point me in the right direction I will greatly appreciate it...also let me know if there are differences from the early 2013 model and late 2013 model that would've created this problem.  Thanks!!
    Robert

    Well, here is what happened...
    Somehow in making a Windows partition then removing the partition so many times I created an error where it only showed 1/2 of my hard drive...like it was starting to create the second half for the windows side and ran into an error.
    So this turned out to be a blessing in disguise, because what I had to do was go to "Command + R" when I was starting up and format the entire drive, all 500 gb.  This formatted the whole drive and must've erased whatever was causing the trouble.
    Of course, then I had to reinstall OS X, and reinstall my Time Machine backup, but then I opened bootcamp and created the Windows partition again.  This time, when I ran the EFI installer you were referring to on the far right (which I had tried before), it allowed me to click next and continue once I selected the Windows partition.  Thank God!  It must've fixed whatever file system error was hanging it up there every time....because it's installing now.
    What I would suggest if all else fails, just format the whole dang thing.  Then try from square one and see if you can install

  • Partition scheme and file systems in dual boot environment [Solved]

    This machine is a general purpose desktop computer used by a single user. The plan is to run Arch primarily and have Ubuntu for backup. I have some experience with Arch and various other linux distros and usually just use a single partition for / with a separate /home partition. On my primary machine, however, I've accumulated a few disks and am wondering how I could best make use of what I have. I may eventually add a 256gb SSD or replace the 80gb drive with it, but currently this is what I have:
    8gb SSD
    80gb SSD
    80gb HDD
    1.5tb HDD
    18gb RAM
    Previously I kept almost everything on the 80gb SSD, including the home directory with individual folders for large files (VM's, music, video) stored on the 1.5tb drive and symlinked into my home directory. This worked very well, except the my home directory still wanted to grow fairly large over time as things accumulate (one culprit was my bitcoin wallet). If I did this again, it would be Arch on the 80gb SSD (probably using BTRFS), Ubuntu on the 80gb HDD (probably EXT4 or BTRFS), and a few different partitions on the 1.5tb drive, mostly BTRFS, depending on what will be stored.
    My other thought was to install both operating systems to the 80gb SSD for maximum speed while putting the home directories on the 80gb HDD or on separate partitions of the 1.5tb drive.
    In either case I'll probably make a /scratch mounted as a tmpfs to make better use of RAM.
    So questions:
    How much does speed matter generally for a home partition?
    Is BTRFS a good choice for this kind of system? More trouble than it's worth?
    Would an LVM make sense in this case? I'd assume there would be performance issues if I tried mixing SSD's and HDD's in an LVM.
    What should I use the small 8gb SSD for?
    Sorry if I've mixed terminology some here, I'm still learning!
    Last edited by spurious_access (2013-07-12 15:51:37)

    1) For most user data, speed is not really of consequence.  But what can matter is the speed of all the configuration files located in your home folder.  They are small, so decreased seek times are going to have a positive effect here.  This is the same reasoning as to why you would want the system configuration files in /etc to be on the SSD (not to mention you'd have a hell of a time separating /etc).
    2) Btrfs is f*cking awesome! 
    3) LVM could make sense, but it depends on what you want specifically.  The only reason you might have a performance hit with LVM2 is if you tried to apply some kind of RAID to it.  That is, striping and mirroring in LVM2 terms.  Obviously, vastly different speeds are going to do limited by whatever is slowest.  But the nice thing about LVM2 is that you can tell lvcreate to ensure that your logical volume is to be created all on one disk.  But btrfs is actually designed to handle disks of different sizes and to some extent, different speeds.
    4) If the 8GB SSD is fast, then maybe you could use it as a nice root filesystem.  I honestly don't think I have ever had my root get any larger than 5GB.  But then I don't run a full DE either, but I also don't keep my system as mega-slim as possible like Trilby.  It might make sense to LVM over the two SSDs and maybe have a separate volume group over the two HDDs.  Or have one btrfs filesystem spanning the two SSDs and one spanning the two HDDs. 
    Ultimately, the needs of your personal usage style is going to dictate what the actual best configuration of your machine is going to be.  But this hodge-podge of disks is defintiely not a terrible thing, and can actually probably be used quite efficiently.  It is totally up to you.
    As a side note (in regard to my "btrfs is f*cking awesome" comment above), I tried btrfs about a year ago.  It was nice, but it was not quite where I had hoped.  But after doing something stoopid on my machine, and having to redo part of my setup, I decided to just rsync my system to another disk, create a btrfs pool, then rsync it back.  I couldn't be happier with my decision.  It is truly amazing the rate at which btrfs is progressing.  New features, more stability, faster speeds, it is all coming along quite nicely.

  • File system partitions

    I'm installing Oracle 9i database on Unix system (HP).
    How many partitions should the file system have?

    U mean how many filesystem.
    It depends on the database. If it's a test one for you (test some feature, ...) you can make only one filesystem.
    For a better installation, but u should create (it's an example):
    /oracle : installation, filesystem
    /oradata01 : datas
    /oradata02 : index
    /log1 : redo log 1
    /log2 : multiplexed redo log
    /arch : archive
    /undo : undo tablespace
    /temp : temporary
    Make the datas, index and redo on differents disks if possible...

  • Oracle VM Server 2.2.1 FIle System Type

    I have installed VM server 2.2.1, but i recently ran into disk size problems and want to resize. I have no space on the / partition and all my space on the /var/ovs/mount/"randomnumber". When i used the parted command "print" to see my partitions, the /var partition has no file system type such as ext3 or ext2. The / partition has ext3. Does anyone know why the /var/ovs/mount/"randomnumber" has no file system type because without this I can not resize the partition. Let me also say that when i installed VM server i pretty much took all the defaults so the partitions were created this way by default.
    Thanks

    Paul_RealityTech wrote:
    I have installed VM server 2.2.1, but i recently ran into disk size problems and want to resize. I have no space on the / partition and all my space on the /var/ovs/mount/"randomnumber". When i used the parted command "print" to see my partitions, the /var partition has no file system type such as ext3 or ext2. The / partition has ext3. Does anyone know why the /var/ovs/mount/"randomnumber" has no file system type because without this I can not resize the partition. Let me also say that when i installed VM server i pretty much took all the defaults so the partitions were created this way by default./var/ovs/mount/UUID is ocfs2 and cannot be shrunk in size.

  • File Systems Problem!

    Hi everyone!
    I've got a nice USB external hard-drive which I'd like to use to back up both my Windows PC and my Macbook. My Windows PC will back up fine with some free software I found on the web, but I would like to use Time Machine to back up my Mac.
    I have thought of partitioning my external hard-drive: one partition in NTFS for Windows and one partition in a file-system readable by my Mac.
    Therefore, I have a question: are there any file systems that both OS X and Windows can read to, that support hard drives of 160gb+?
    Many thanks for your help in advance
    A

    For Time Machine to work properly (or at all, really), you need to use the HFS+ (Apple) filesystem. HFS+ is the only filesystem which will support the Apple metadata and other special "junk" that required to properly preserve your files. Time Machine relies heavily on this.
    Windows can't normally read or write HFS+ filesystems. However, there is a commercial program that is reportedly able to do this:
    http://www.mediafour.com/products/macdrive/
    (I am not affiliated with them in any way.) Depending on what you use for backup in Windows, this may just do the trick.
    Personally, I have an external HFS+ USB drive dedicated to Apple backups (we have a few in the house), and another FAT32 one dedicated to Windows/Linux backups.

  • File system full.. swap space limit.

    When i try to install Solaris 8x86 i recieve the following error.
    warning:/tmp:file system full, swap space limit exeeded
    Copying mini-root to local disk. Warning &pci@0,0&pci/ide@7,1&ide@1 ata:
    timeout: abort request, target 0 lun 0
    retrying command .. done
    copying platform specific files .. done , i have a 46 Gb IBM DTLA45 HD
    ,the solaris partition was set to 12 Gb , swap to 1,2 Gb .
    After a while I recieve Warning:/tmp/:file system full,swap space limit exeeded. , Why?
    I have already used the 110202 patch for the Harddrive.
    How should I solve this?
    Thanks
    \DJ

    Hi,
    Are you installing using the Installation CD?
    If so, try booting and installing with the Software 1 of 2 CD.
    Hope that helps.
    Ralph
    SUN DTS

  • [Solved] Do I need a swap partition /swap file?

    Hello Arch Community.
    I want to install Arch Linux on my Aspire V5-573G Notebook with 8GB RAM and a 120GB 840 Evo SSD from Samsung. So my question is, do I actually need a swap partition / swap file? I read the arch-wiki pages about swap and suspend-to-disk / suspend-to-ram, and the only thing thats obviously profiting from / needing a swap partition is suspend-to-disk, no other things are mentioned in this regard. Is a swap partition in any other way important?
    Thanks in advance.
    Last edited by Oedner (2013-12-21 12:41:19)

    headkase wrote:Another question to ask is what will happen if you don't have a swap file and run out of memory?  In that case the Linux kernel will randomly kill process' until there is enough memory again.  Obviously that isn't very stable but that is what it will do.
    No. The OOM killer is pretty darn tweaked these days and usually(!) kills the actual perpetrator. The alternative—disabling memory overcommitting and answering memory requests with an out-of-memory error—can result in unforeseen problems as well: What if it  a system process is trying to allocate a few bytes for some random string, and what if said system process isn't equipped to handle ENOMEM gracefully and crashes, because the default policy on Linux is to overcommit and never answer with out-of-memory errors?
    Just trying to play devil's advocate here. I'm not happy with the OOM killer either and I'd rather have a deterministic solution to out-of-memory situations, but I realize that it's probably not an easy problem to solve.

  • Sol10 u8 installed on a ZFS Root File System have different swap needs?

    Does Sol10 u8 installed on a ZFS Root File System have different swap needs/processes?
    Information:
    I've installed Solaris 10 (10/09 s10s_u8wos_08a SPARC, Assembled 16 September 2009) on a half dozen servers and every one of them no longer mount swap at boot.
    The install program commented out the old swap entry and created this one:
    # grep swap /etc/vfstab
    swap - /tmp tmpfs - yes -
    Everything works like a champ. I didn't discover the issue until I tried to install some patches and the install failed. It didn't fail because of lack of swap - it refused to run because it found "No swap devices configured".
    Here are the symptoms:
    # swap -s
    total: 183216k bytes allocated + 23832k reserved = 207048k used, 13600032k available
    # swap -l
    No swap devices configured
    # mount | grep swap
    /etc/svc/volatile on swap read/write/setuid/devices/xattr/dev=5ac0001 on Mon Apr 19 08:06:45 2010
    /tmp on swap read/write/setuid/devices/xattr/dev=5ac0002 on Mon Apr 19 08:07:40 2010
    /var/run on swap read/write/setuid/devices/xattr/dev=5ac0003 on Mon Apr 19 08:07:40 2010
    #

    Hi Nitabills,
    I assume that you create a zfs entry for swap with the commande zfs create -V $size
    did you launch the command :
    swap -a /dev/zvol/dsdk/$ZPOOL/swap
    Try this entry below in the vfstab :
    /dev/zvol/dsdk/$ZPOOL/swap - - swap - no -

  • [SOLVED] Virtual Memory Exhausted with unused 16g Swap Partition.

    Hello all, long time reader, first time poster. So basically what I'm running into is that I'm having Virtual Memory Exhausted errors with various programs even though I have a 16g swap partition mounted. I've manually enabled it to try it as well. Here's some outputs to give you an idea of how my system is set up. It's a UEFI fresh install, only a couple days old.
    fstab:
    # /etc/fstab: static file system information
    # <file system> <dir> <type> <options> <dump> <pass>
    tmpfs /tmp tmpfs nodev,nosuid 0 0
    # /dev/sdb3
    UUID=ea7a0311-6314-4215-b98d-7360552b28c4 / ext4 rw,relatime,data=ordered 0 1
    # /dev/sdc3
    UUID=8f6f2006-3a9c-4563-a149-547d758e2af1 /home ext4 rw,relatime,data=ordered 0 2
    # /dev/sdb2
    UUID=baf1ba80-ddf3-4cbb-a13e-b81a0af0a9e7 /boot ext4 rw,relatime,data=ordered 0 2
    # /dev/sdb1
    UUID=2B46-5340 /boot/efi vfat rw,relatime,fmask=0022,dmask=0022,codepage=437,iocharset=iso8859-1,shortname=mixed,errors=remount-ro 0 2
    # /dev/sdc1
    UUID=4336d783-c289-4fbf-8c59-f1a1da782130 /var ext4 rw,relatime,data=ordered 0 2
    # /dev/sdc2
    UUID=96a60f08-a57f-42f1-80ff-846d02a29199 /var/log ext4 rw,relatime,data=ordered 0 2
    # /dev/sda2
    UUID=c5d5879a-b0e8-4976-8057-2f95975a1251 /share ext4 rw,relatime,data=ordered 0 2
    # /dev/sdb4
    UUID=6e6277c4-a69a-4838-83cd-c206959acf0e /store ext4 rw,relatime,data=ordered 0 2
    #swap
    UUID=21a56b10-85e5-48a1-91e5-995eae0dfba4 none swap defaults 0 0
    lsblk
    NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
    sda 8:0 0 931.5G 0 disk
    ├─sda1 8:1 0 16G 0 part [SWAP]
    └─sda2 8:2 0 915.5G 0 part /share
    sdb 8:16 0 931.5G 0 disk
    ├─sdb1 8:17 0 1G 0 part /boot/efi
    ├─sdb2 8:18 0 1G 0 part /boot
    ├─sdb3 8:19 0 50G 0 part /
    └─sdb4 8:20 0 879.5G 0 part /store
    sdc 8:32 0 931.5G 0 disk
    ├─sdc1 8:33 0 20G 0 part /var
    ├─sdc2 8:34 0 2G 0 part /var/log
    └─sdc3 8:35 0 909.5G 0 part /home
    sr0 11:0 1 1024M 0 rom
    cat /proc/meminfo
    MemTotal: 12256600 kB
    MemFree: 9926584 kB
    Buffers: 212588 kB
    Cached: 774636 kB
    SwapCached: 0 kB
    Active: 1179860 kB
    Inactive: 638584 kB
    Active(anon): 831604 kB
    Inactive(anon): 14480 kB
    Active(file): 348256 kB
    Inactive(file): 624104 kB
    Unevictable: 4 kB
    Mlocked: 4 kB
    SwapTotal: 16777212 kB
    SwapFree: 16777212 kB
    Dirty: 32 kB
    Writeback: 0 kB
    AnonPages: 831320 kB
    Mapped: 196008 kB
    Shmem: 14892 kB
    Slab: 345008 kB
    SReclaimable: 316620 kB
    SUnreclaim: 28388 kB
    KernelStack: 2616 kB
    PageTables: 27032 kB
    NFS_Unstable: 0 kB
    Bounce: 0 kB
    WritebackTmp: 0 kB
    CommitLimit: 22905512 kB
    Committed_AS: 3365808 kB
    VmallocTotal: 34359738367 kB
    VmallocUsed: 357936 kB
    VmallocChunk: 34359373819 kB
    HardwareCorrupted: 0 kB
    AnonHugePages: 86016 kB
    HugePages_Total: 0
    HugePages_Free: 0
    HugePages_Rsvd: 0
    HugePages_Surp: 0
    Hugepagesize: 2048 kB
    DirectMap4k: 117756 kB
    DirectMap2M: 4059136 kB
    DirectMap1G: 8388608 kB
    swapon -s
    Filename Type Size Used Priority
    /dev/sda1 partition 16777212 0 -1
    core file size (blocks, -c) 0
    data seg size (kbytes, -d) unlimited
    scheduling priority (-e) 20
    file size (blocks, -f) unlimited
    pending signals (-i) 94832
    max locked memory (kbytes, -l) 64
    max memory size (kbytes, -m) unlimited
    open files (-n) 1024
    pipe size (512 bytes, -p) 8
    POSIX message queues (bytes, -q) 819200
    real-time priority (-r) 0
    stack size (kbytes, -s) 8192
    cpu time (seconds, -t) unlimited
    max user processes (-u) 94832
    virtual memory (kbytes, -v) unlimited
    file locks (-x) unlimited
    I did just notice that it's showing 4gb less RAM than there should be (12 instead of 16, I'll be checking into that about the same time I hit submit) but as far as I can tell the system shouldn't even be worried about swap 99.99% of the time. Any ideas?
    Edit: On reboot system show the full 16gb of RAM.
    Last edited by inquisitorthreefive (2012-11-19 07:44:32)

    inquisitorthreefive wrote:
    I did just notice that it's showing 4gb less RAM than there should be (12 instead of 16, I'll be checking into that about the same time I hit submit) but as far as I can tell the system shouldn't even be worried about swap 99.99% of the time. Any ideas?
    Edit: On reboot system show the full 16gb of RAM.
    Could it be a hardware problem with RAM? Is there a 4 GB RAM chip in the machine that may have failed?

  • 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 ?

  • [SOLVED] Swap Partition keeps being automounted, but it shouldn't.

    Hi,
    I created a swap partition as part of setting up a Linux From Scratch installation, and it was intended for that system only. However it is automounted every time I boot my arch.
    It is neither mentioned in my fstab or my mtab. I tried # swapoff , and that disables it for that instance, but after boot it's mounted again. Tried giving it an fstab entry with the noauto option.
    Last edited by krork (2015-01-05 18:11:24)

    Thanks Guys!
    I have not yet found a way to stop systemd from automounting the swap partition. I'm a bit busy this January. However, as a workaround I created a swapoff.service file in /etc/systemd/system with this content:
    [Unit]
    Description=Turns off Swap Partition
    DefaultDependencies=no
    After=getty.target
    [Service]
    ExecStart=/usr/bin/swapoff /dev/sdaX
    [Install]
    WantedBy=multi-user.target
    Replace the /dev/sdaX with your according partition, of course.
    Edit: Also you'll want to enable it: # systemctl enable swapoff.service
    So in case anyone else is having this problem and just wants a dirty fix, this worked for me, for now. If I find out how to keep systemd from automounting in the first place I'll let you know.
    Last edited by krork (2015-01-05 16:50:33)

Maybe you are looking for