No swap space

Archived topics about LMDE 1 and LMDE 2
Locked
dimi

No swap space

Post by dimi »

I recently realized my LMDE installation doesn't have swap space. When I open too many tabs in Chromium it just becomes really slow or even halts. How can I create swap space or a swap file?
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 1 time in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
bigj231

Re: No swap space

Post by bigj231 »

You'll have to repartition your disks and make a swap partition. Make a complete system backup on another drive before you try changing anything with your disks. Or you could install more RAM. RAM is faster than swap.
Ken_g6

Re: No swap space

Post by Ken_g6 »

Alternatively, it ought to be possible to make a swap file. But I haven't tried it. The of= path should probably be something like /var/tmp/swapfile for an installation as opposed to a LiveCD, and I'm not at all sure how to make it automatic on boot.
bigj231

Re: No swap space

Post by bigj231 »

You could probably make that swapfile and then add it to your fstab. I moved my /tmp to RAM this way.
widget

Re: No swap space

Post by widget »

dimi wrote:I recently realized my LMDE installation doesn't have swap space. When I open too many tabs in Chromium it just becomes really slow or even halts. How can I create swap space or a swap file?
Please post the output of \;

Code: Select all

sudo fdisk l
That is a lower case L.
dimi

Re: No swap space

Post by dimi »

Code: Select all

$ sudo fdisk l
fdisk: unable to open l: Bestand of map bestaat niet
Translation: File or folder doesn't exist.
axel112
Level 1
Level 1
Posts: 6
Joined: Sun Jan 08, 2012 7:16 am

Sv: No swap space

Post by axel112 »

sudo fdisk -l
dimi

Re: No swap space

Post by dimi »

Code: Select all

Disk /dev/sda: 320.1 GB, 320072933376 bytes
255 heads, 63 sectors/track, 38913 cylinders, total 625142448 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x52fe08c8

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1       209921355   625137344   207607995   83  Linux
/dev/sda2   *        2048      204799      101376    7  HPFS/NTFS/exFAT
/dev/sda3          204800   209919999   104857600    7  HPFS/NTFS/exFAT

Partition table entries are not in disk order
widget

Re: No swap space

Post by widget »

Sorry about that. Sometimes I just can't type.

I am not sure where your sda3 partition is but it is a nice large partition that probably has a good chunk of empty space at the end of it.

Swap can be anywhere on the drive. It also wil need to be in you /etc/fstab file so that your install can find it.

While backing up your data when doing any partitioning is a good idea and you should do it there is little chance of it going sour. The big problem with MS related partitions is a certain pickyness about exactly where they start. In this case that will not be a problem.

I would fire up your Live CD/DVD and shrink that sda3 partition to create the space for swap. I would think 1 or 2 gigs would be plenty but many recommend 2 times your amount of ram. That is up to you. Shrinking the partition using gparted will be fine. Shrink it from the right end (empty end) to the left.

Create a partition in the space left by that shrinkage formatted to "linux swap".

You will need to edit the /etc/fstab file to have an entry like;

Code: Select all

#Entry for /dev/sda4 :
UUID=2758aefb-1847-42ea-92c0-cefddf6a8460	none	swap	  sw	0	0
The first line that is commented out is not really needed but is always included by default when the fstab is generated by the installer and I kind of like the information.

The second line is what does the job of telling your OS where to look for swap. The uuid info needs to be in that format. You can get the uuid of /swap by running;

Code: Select all

sudo blkid
You can copy paste the info from terminal to your text editor but you will need to remove the quotation marks from the uuid from the terminal. Copy/paste is the way to go as it is a long number.

If you have never pulled up a file in a text editor it should be done this way;

Code: Select all

sudo gedit /etc/fstab
"gedit" can be replaced by what ever text editor you have or like to use.

You can do that from your Live Session or wait until you log back into your install. If you do it from inside your install you will have to log out and back in to have it take effect as the fstab is read as part off booting up.
Locked

Return to “LMDE Archive”