Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 07-07-2010, 12:17 PM   #1
LQ Newbie
Registered: Jul 2010
Posts: 1

Rep: Reputation: 0
Excessive swap file

Hi just a quick question...

We have just been looking at a swap file on one of our Linux boxes and have noticed it's at 23gb which seems pretty big.
I was wondering is there a way we can find out

A: What it's original size was (so we can see how much it's grown)
B: What's in the file at the moment.

Old 07-07-2010, 01:15 PM   #2
Senior Member
Registered: Oct 2004
Distribution: Fedora Core 4, 12, 13, 14, 15, 17
Posts: 2,279

Rep: Reputation: 249Reputation: 249Reputation: 249
I didn't think there was a swap "file" in linux. There is a swap partition but you don't access it from a filesystem. You can run top to see details about it's size and usage, but it is not a dynamically resized item.

Maybe you are looking at something in /tmp ?
Old 07-07-2010, 01:53 PM   #3
Registered: Aug 2002
Posts: 17,841

Rep: Reputation: 2404Reputation: 2404Reputation: 2404Reputation: 2404Reputation: 2404Reputation: 2404Reputation: 2404Reputation: 2404Reputation: 2404Reputation: 2404Reputation: 2404
Yes, you can have swap file(s) in addition to partition(s). AFAIK and as already stated they are not dynamic. swap is not mountable nor is it a real filesystem but it maybe possible to examine its contents with utilities like testdisk and photorec. Without reference to hardware and what type of applications you run it is difficult to say how much swap is really required.

BTW tmpfs is dynamic and can shrink and grow as required.
Old 07-07-2010, 06:51 PM   #4
LQ Veteran
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 17,258

Rep: Reputation: 2640Reputation: 2640Reputation: 2640Reputation: 2640Reputation: 2640Reputation: 2640Reputation: 2640Reputation: 2640Reputation: 2640Reputation: 2640Reputation: 2640
A: As stated above, it won't have "grown" - that was the size it was initially allocated (file or partition, same applies).
B: "swapon -s" will give you the status of any/all swap extents currently in use.

Unless you are using RHEL, that size is just a waste of disk space, as the system won't use it all (RH have a patch to use bigger).


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
swap file vs. swap partition verndog Ubuntu 16 07-09-2012 09:49 PM
Can swap file or a swap partition be mounted and read? Mr-Bisquit Linux - General 3 06-08-2009 03:16 PM
Excessive RAM/swap usage Jinouchi Linux - Software 10 03-09-2009 10:59 AM
swap file or swap space? simonb1975uk Linux - General 11 08-15-2008 03:39 PM
Need Help Increasing Swap by creating a swap file froggo Red Hat 3 06-13-2006 09:04 AM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 03:06 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration