Choose style:

Author Topic: SWAP PARTITION vs Swap File  (Read 667 times)

0 Members and 1 Guest are viewing this topic.

Offline snowy46

  • nOOb
  • *
  • Posts: 23
  • Karma: 1
  • New Forum User
    • View Profile
SWAP PARTITION vs Swap File
« on: May 16, 2019, 04:52:41 pm »
I set up a 8gb SWAP partition physically after Ubuntu and before Peppermint, and created the Peppermint Ext 4 Partition BEFORE Pep9 Installation. On Installation (from TRY PEP) I was presented with almost no options, I think it just picked the right partition, nothing about SWAP either, so it is creating a 1 gb Swap internal file. Is it better to leave that, or force it to use the SWAP partition?  Is the Swap file increased in size as needed? In most normal use with 8gb RAM, you don't need much Swap, but when I do video editing, that might become an issue.
« Last Edit: May 16, 2019, 04:54:54 pm by snowy46 »

Online murraymint

  • Trusted User
  • Veteran
  • *****
  • Posts: 1935
  • Karma: 335
  • soft boiled with a yolk of gold
    • View Profile
  • Peppermint version(s): 7, 8, 9
Re: SWAP PARTITION vs Swap File
« Reply #1 on: May 16, 2019, 04:59:22 pm »
Did you set the swapon flag on the partition?

The swap file should be able to expand as needed if there's space on the partition.

If you chose "something else" you would be able to manually specify using the swap partition and I think you would end up without the swap file.

Offline PCNetSpec

  • Administrator
  • Hero
  • *****
  • Posts: 25280
  • Karma: 2793
  • "-rw-rw-rw-" .. The Number Of The Beast
    • View Profile
    • PCNetSpec
  • Peppermint version(s): Peppermint 8R, 9, and 9R
Re: SWAP PARTITION vs Swap File
« Reply #2 on: May 16, 2019, 07:07:33 pm »
No out of the box the swapfile isn't "automatically" (dynamically) resized .. but it **is** much easier to resize manually should you ever need to .. also unlike resizing a swap partition it involves no messing around with the partition table (and the associated risks).

There are tools to manage swap files dynamically, such as "swapspace" and "dphys-swapfile" .. but I'd personally not bother.
https://unix.stackexchange.com/questions/134258/dynamically-growing-swap-file-on-debian
(equally applies to Ubuntu and derivatives)



Also, on an SSD I'd expect a swap FILE could get moved around to a greater extent by the firmwares wear levelling routine .. a swap PARTITION on the other hand (at least where there's no overprovisioning)  I would think kinda forces swap writes to be concentrated on a single part of the drive (though I should add I could be wrong here, I'm not an SSD firmware expert).
« Last Edit: May 16, 2019, 07:17:12 pm by PCNetSpec »
WARNING: You are logged into reality as 'root' .. logging in as 'insane' is the only safe option.

Team Peppermint
PCNetSpec

Offline snowy46

  • nOOb
  • *
  • Posts: 23
  • Karma: 1
  • New Forum User
    • View Profile
Re: SWAP PARTITION vs Swap File
« Reply #3 on: May 17, 2019, 10:08:51 pm »
No didn't set swapon flag, thought Pep would search for any partition called SWAP.  I created the Windows Partitions in Windows, then the EXT4 partitions in Ubuntu (I think).  Playing with it in Pep9 "Disks", in Mount Options, should I list SWAPON in the line with nosuid, nodev, nofail, x-gvfs-show..... and where exactly? Oh, I see EDIT PARTITION has a LINUX SWAP type file- should I check "System Partition" checkbox? If I do that will Pep9 just pick it up on bootup or must it be led by the nose?  [Or should I do it from Ubuntu 18.4?] I remember obvious such flags in GParted, whatever happened to that? Can I install GParted, seems it's discontinued, because the DISKS doesn't let me move partitions, which with 17, I have to.

Well, youz didn't answer the question - is having a separate near SWAP partition better or a Swap file??? My Ubuntu partition is +90gb, is that too big a jump for back and forth writes? The SWAP Partition is just before Pep. How would I resize the Swap file?  I don't really have too much space on Peppermint, planned all data to be on EXT-DATA partition, shareable with Ubuntu.
« Last Edit: May 18, 2019, 08:19:22 pm by snowy46 »

Offline Slim.Fatz

  • Trusted User
  • Veteran
  • *****
  • Posts: 1727
  • Karma: 464
  • Where's the mouse?
    • View Profile
  • Peppermint version(s): Peppermint 7, 8.5 & 9 - 64bit
Re: SWAP PARTITION vs Swap File
« Reply #4 on: May 18, 2019, 03:27:42 am »
Can I install GParted, seems it's discontinued, because the DISKS doesn't let me move partitions, which w 17, I have to on one.

Hi snowy46,

Not sure what you mean with "which w 17, I have to on one"  :-\ but, yes, you can install gparted using various methods (e.g. using the Synaptic package manager -- which is perhaps easiest if you are uncomfortable using the terminal -- or by using terminal commands, just to name two). Using terminal commands: open a terminal then enter this:
Code: [Select]
sudo apt-get install gparted
Well, youz didn't answer the question - is having a separate near SWAP partition better or a Swap file???


This question does not have a definitive answer. Depending on your needs and purposes one might be better than the other. The same goes for the size: You might need 4 or 8 Gigs or you might be wasting space with that much and only need 1 or 2 Gigs. These things do not have a simple "black or white" answer that applies to every user. It's similar to the question "Which is better: a bicycle with skinny racing tires or one with fat knobby tires?"  ;)

Regards,

-- Slim
« Last Edit: May 18, 2019, 03:29:58 am by Slim.Fatz »
"Life first -- Peppermint a close 2nd!" -- Zeb

Tread lightly: Fluxbox, JWM, i3, Openbox, awesome

Online murraymint

  • Trusted User
  • Veteran
  • *****
  • Posts: 1935
  • Karma: 335
  • soft boiled with a yolk of gold
    • View Profile
  • Peppermint version(s): 7, 8, 9
Re: SWAP PARTITION vs Swap File
« Reply #5 on: May 18, 2019, 05:16:15 am »
No didn't set swapon flag, thought Pep would search for any partition called SWAP.

I did mention this the last time you brought it up but you didn't ask about it then. Just right-click the partition in Gparted and choose swapon from the context menu.

Offline snowy46

  • nOOb
  • *
  • Posts: 23
  • Karma: 1
  • New Forum User
    • View Profile
Re: SWAP PARTITION vs Swap File
« Reply #6 on: May 18, 2019, 08:26:15 pm »
Would doing that in GParted also make it findable to Peppermint??  Mostly I'm going to mostly use Pep9 (hate the Ubuntu file manager and the applications layout), so I see in DISKS Program that EDIT PARTITION has a LINUX SWAP type file- should I check "System Partition" checkbox?

Offline snowy46

  • nOOb
  • *
  • Posts: 23
  • Karma: 1
  • New Forum User
    • View Profile
Re: SWAP PARTITION vs Swap File
« Reply #7 on: June 04, 2019, 05:27:34 pm »
OK, MOST of the time I think won't need much SWAP at all, with 8gb RAM and I5...    a 1gb file is fine (can I expand that somewhere?), but for some things like serious video editing, or maybe those hideous Windows "Version Feature Updates", I will, I presume.  There is no informational anywhere that I read that a dedicated SWAP partition was now obsolete or not recommended, and the Installation was strange- it just chose a partition, luckily the one I created named Peppermint, never asked where I wanted to put it; or anything about a Swap partition. Freaked me out for a while.

Offline PCNetSpec

  • Administrator
  • Hero
  • *****
  • Posts: 25280
  • Karma: 2793
  • "-rw-rw-rw-" .. The Number Of The Beast
    • View Profile
    • PCNetSpec
  • Peppermint version(s): Peppermint 8R, 9, and 9R
Re: SWAP PARTITION vs Swap File
« Reply #8 on: June 05, 2019, 05:22:42 am »
Swap space (whether a file or partition) is not shared with Windows.

and yes a Linux swap file can be expanded, but only manually (basically from the command line).

If you're going to have a small swap file/partition, it'd probably be a good idea to set swappiness to a lower value (such as 10) than the default 60.
« Last Edit: June 05, 2019, 05:24:24 am by PCNetSpec »
WARNING: You are logged into reality as 'root' .. logging in as 'insane' is the only safe option.

Team Peppermint
PCNetSpec

Offline snowy46

  • nOOb
  • *
  • Posts: 23
  • Karma: 1
  • New Forum User
    • View Profile
Re: SWAP PARTITION vs Swap File
« Reply #9 on: June 21, 2019, 10:44:45 am »
OK. I installed GParted, formated the SWAP partition as SWAP, then set the flag (didn't show before).

How do i test if it is now using the SWAP partition, and if so, and then can I delete the Swap file in root?

Oh, I know Windows doesn't use Ubuntu Swap, I'm not a compete moron.
« Last Edit: June 21, 2019, 10:47:34 am by snowy46 »

Offline PCNetSpec

  • Administrator
  • Hero
  • *****
  • Posts: 25280
  • Karma: 2793
  • "-rw-rw-rw-" .. The Number Of The Beast
    • View Profile
    • PCNetSpec
  • Peppermint version(s): Peppermint 8R, 9, and 9R
Re: SWAP PARTITION vs Swap File
« Reply #10 on: June 21, 2019, 02:57:03 pm »
What's the output from:
Code: [Select]
free -m
and
Code: [Select]
swapon -s
and the contents of
Code: [Select]
xed /etc/fstab
WARNING: You are logged into reality as 'root' .. logging in as 'insane' is the only safe option.

Team Peppermint
PCNetSpec

Offline snowy46

  • nOOb
  • *
  • Posts: 23
  • Karma: 1
  • New Forum User
    • View Profile
Re: SWAP PARTITION vs Swap File
« Reply #11 on: June 23, 2019, 04:26:02 pm »
             total        used        free      shared  buff/cache   available
Mem:           7846        1593         640         226        5613        5746
Swap:           926           0         926
   --------------------------------------------------------------------------

/swapfile                                 file       948408   0   -2
------------------------------------------------------------------------------

 /etc/fstab: static file system information.
#
# Use 'blkid' to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name devices
# that works even if disks are added and removed. See fstab(5).
#
# <file system> <mount point>   <type>  <options>       <dump>  <pass>
# / was on /dev/sda12 during installation
UUID=5ca2ed63-200e-47b0-a5ba-d3ea2f69dd92 /               ext4    errors=remount-ro 0       1
# /boot/efi was on /dev/sda1 during installation
UUID=9C80-D259  /boot/efi       vfat    umask=0077      0       1
/swapfile                                 none            swap    sw              0       0
  --------------------------------------------------------------------------------------------------

Still using the Swap File, I guess. What des the FSTAB tell you?



Online murraymint

  • Trusted User
  • Veteran
  • *****
  • Posts: 1935
  • Karma: 335
  • soft boiled with a yolk of gold
    • View Profile
  • Peppermint version(s): 7, 8, 9
Re: SWAP PARTITION vs Swap File
« Reply #12 on: June 23, 2019, 05:04:44 pm »
What's the output of

Code: [Select]
sudo blkid

Offline snowy46

  • nOOb
  • *
  • Posts: 23
  • Karma: 1
  • New Forum User
    • View Profile
Re: SWAP PARTITION vs Swap File
« Reply #13 on: June 24, 2019, 06:04:50 pm »
Code: [Select]
/dev/sda1: LABEL="ESP" UUID="9C80-D259" TYPE="vfat" PARTLABEL="EFI system partition" PARTUUID="7bee0daf-acfa-416a-a7d3-414d45abd61a"
/dev/sda3: LABEL="OS" UUID="BAA8EA4EA8EA0929" TYPE="ntfs" PARTLABEL="Basic data partition" PARTUUID="1e6dc271-0ec5-4fb2-8f86-02b2dff4baae"
/dev/sda4: UUID="48DA8D62DA8D4D5E" TYPE="ntfs" PARTUUID="40bcb38c-2674-407b-9843-d8a711e3ee9a"
/dev/sda5: LABEL="DATA200--NTSF" UUID="5890DAB290DA95BA" TYPE="ntfs" PARTLABEL="Basic data partition" PARTUUID="c76c2290-0fad-45cc-b850-57eb96ee768a"
/dev/sda6: LABEL="LIAM" UUID="DCA2052EA2050F28" TYPE="ntfs" PARTLABEL="Basic data partition" PARTUUID="ff2b4905-098b-4743-89ca-b6ef6569d306"
/dev/sda7: LABEL="PHOTOG" UUID="FE348AD8348A92F7" TYPE="ntfs" PARTLABEL="Basic data partition" PARTUUID="8c25e779-1fac-4f6c-9010-f4da71af93ea"
/dev/sda8: LABEL="VIDEO" UUID="36482AA6482A6539" TYPE="ntfs" PARTLABEL="Basic data partition" PARTUUID="f93c48cc-e26e-4b71-91f4-0f8ee0792e38"
/dev/sda9: LABEL="Inspir" UUID="30325EEF325EB994" TYPE="ntfs" PARTLABEL="Basic data partition" PARTUUID="99c9aab5-2d80-47b5-9b41-00ea611b34f0"
/dev/sda10: LABEL="UBUNTU18.4.2" UUID="06145b54-fc8c-457a-8d18-fd356c9dc60a" TYPE="ext4" PARTLABEL="/" PARTUUID="312cf531-2038-450e-9651-cbeb1b43166a"
/dev/sda11: UUID="fb384122-583e-4905-a243-24c1a672eb92" TYPE="swap" PARTUUID="709e6604-49b8-43e5-b227-0a16d0822865"
/dev/sda12: UUID="5ca2ed63-200e-47b0-a5ba-d3ea2f69dd92" TYPE="ext4" PARTLABEL="Peppermint9" PARTUUID="82e65324-aa9a-4498-bacf-6d858d8739c5"
/dev/sda13: LABEL="DATA-Ext" UUID="973448ed-a6ad-407d-90c3-ae801c7e6fc7" TYPE="ext4" PARTUUID="c66aee3f-d0c5-4769-bc4e-2937a1def736"
/dev/sda14: UUID="407acd69-a9b6-4b30-b13a-f64009e61f13" TYPE="crypto_LUKS" PARTUUID="73f30b7a-3cf9-43fa-8a84-352266d212d5"
/dev/sda15: LABEL="WINRETOOLS" UUID="EC5450C054508EE8" TYPE="ntfs" PARTUUID="c07a61c7-af87-40fa-b710-298414d374be"
/dev/sda16: LABEL="Image" UUID="442C51AB2C5198AE" TYPE="ntfs" PARTUUID="bcb9ab22-4aec-43dd-b2e1-74efa05e1418"
/dev/sda17: LABEL="DELLSUPPORT" UUID="10E23F27E23F1088" TYPE="ntfs" PARTUUID="ce1d4056-572b-4b2e-a43c-5dbcba683597"
/dev/loop0: TYPE="squashfs"
/dev/loop1: TYPE="squashfs"
/dev/loop2: TYPE="squashfs"
/dev/loop3: TYPE="squashfs"
/dev/sda2: PARTLABEL="Microsoft reserved partition" PARTUUID="810a91bc-e57b-4fef-9243-663615c23046"

Online murraymint

  • Trusted User
  • Veteran
  • *****
  • Posts: 1935
  • Karma: 335
  • soft boiled with a yolk of gold
    • View Profile
  • Peppermint version(s): 7, 8, 9
Re: SWAP PARTITION vs Swap File
« Reply #14 on: June 24, 2019, 06:38:20 pm »
Edit /etc/fstab:

Code: [Select]
gksudo xed /etc/fstab

Replace the line about /swapfile with these two lines:

Code: [Select]
# swap is on /dev/sda11
UUID=fb384122-583e-4905-a243-24c1a672eb92 none            swap    sw              0       0
Save the file.

I think you also have to do this:
Code: [Select]
echo "RESUME=UUID=fb384122-583e-4905-a243-24c1a672eb92" | sudo tee /etc/initramfs-tools/conf.d/resume
Code: [Select]
sudo update-initramfs -uk all
Code: [Select]
sudo update-grub

Reboot. Now test with
Code: [Select]
swapon -s
« Last Edit: June 24, 2019, 06:43:57 pm by murraymint »