No swap space

All Gurus once were Newbies
Forum rules
There are no such things as "stupid" questions. However if you think your question is a bit stupid, then this is the right place for you to post it. Please stick to easy to-the-point questions that you feel people can answer fast. For long and complicated questions prefer the other forums within the support section.
Before you post please read this

No swap space

Postby dimi on Fri Nov 30, 2012 2:23 pm

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?
dimi
Level 1
Level 1
 
Posts: 12
Joined: Sun Apr 15, 2012 4:43 am

Linux Mint is funded by ads and donations.
 

Re: No swap space

Postby bigj231 on Sat Dec 01, 2012 2:50 pm

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.
Running on a 4-slot toaster @ 60Hz
User avatar
bigj231
Level 5
Level 5
 
Posts: 793
Joined: Fri Feb 26, 2010 10:16 am
Location: Middle of Nowhere

Re: No swap space

Postby Ken_g6 on Sat Dec 01, 2012 3:00 pm

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.
Ken_g6
Level 1
Level 1
 
Posts: 18
Joined: Fri May 11, 2012 12:43 pm

Re: No swap space

Postby bigj231 on Sat Dec 01, 2012 5:05 pm

You could probably make that swapfile and then add it to your fstab. I moved my /tmp to RAM this way.
Running on a 4-slot toaster @ 60Hz
User avatar
bigj231
Level 5
Level 5
 
Posts: 793
Joined: Fri Feb 26, 2010 10:16 am
Location: Middle of Nowhere

Re: No swap space

Postby widget on Sun Dec 02, 2012 11:59 am

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.
Dell XPS 420 Core2 Quad Q 6600, audigy5.1, Radeon HD 6450 - currently 4 320Gb HDD, Debian Squeeze for secure use, Debian testing for daily use, Debian Sid for fun.
widget
Level 3
Level 3
 
Posts: 167
Joined: Thu May 14, 2009 2:49 am
Location: S.E. Montana

Re: No swap space

Postby dimi on Sun Dec 02, 2012 12:54 pm

Code: Select all
$ sudo fdisk l
fdisk: unable to open l: Bestand of map bestaat niet

Translation: File or folder doesn't exist.
dimi
Level 1
Level 1
 
Posts: 12
Joined: Sun Apr 15, 2012 4:43 am

Sv: No swap space

Postby axel112 on Sun Dec 02, 2012 12:59 pm

sudo fdisk -l
axel112
Level 1
Level 1
 
Posts: 6
Joined: Sun Jan 08, 2012 7:16 am

Re: No swap space

Postby dimi on Sun Dec 02, 2012 2:44 pm

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
dimi
Level 1
Level 1
 
Posts: 12
Joined: Sun Apr 15, 2012 4:43 am

Re: No swap space

Postby widget on Tue Dec 04, 2012 3:45 pm

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.
Dell XPS 420 Core2 Quad Q 6600, audigy5.1, Radeon HD 6450 - currently 4 320Gb HDD, Debian Squeeze for secure use, Debian testing for daily use, Debian Sid for fun.
widget
Level 3
Level 3
 
Posts: 167
Joined: Thu May 14, 2009 2:49 am
Location: S.E. Montana

Re: No swap space

Postby mintybits on Tue Dec 04, 2012 4:03 pm

mintybits
Level 5
Level 5
 
Posts: 827
Joined: Fri Jan 27, 2012 5:09 pm

Linux Mint is funded by ads and donations.
 

Return to Newbie Questions

Who is online

Users browsing this forum: np43 and 4 guests