LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
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!

Notices


Reply
  Search this Thread
Old 07-27-2012, 11:36 AM   #1
dundu
LQ Newbie
 
Registered: Jul 2012
Distribution: Redhat,Fedora,centos
Posts: 17

Rep: Reputation: Disabled
Question what the difference swap space and swap file


Hi,


what the use of swap file ?,is swap file is necessary for while swap extend
 
Old 07-27-2012, 11:46 AM   #2
Kustom42
Senior Member
 
Registered: Mar 2012
Distribution: Red Hat
Posts: 1,604

Rep: Reputation: 415Reputation: 415Reputation: 415Reputation: 415Reputation: 415
http://en.wikipedia.org/wiki/Swap_file

Thats got all the info you want. If you have any specific questions after reading over it let me know.
 
1 members found this post helpful.
Old 07-28-2012, 05:13 PM   #3
Karl Godt
Member
 
Registered: Mar 2010
Location: Kiel , Germany
Distribution: once:SuSE6.2,Debian3.1, aurox9.2+3,Mandrake?,DSL? then:W7st,WVHB, #!8.10.02,PUPPY4.3.1 now:Macpup
Posts: 314

Rep: Reputation: 45
Windows uses one or two swap files inside the C:\ Drive while Linux uses normally a swap partition .

To create a swap-file from the bash terminal console :

Code:
dd if=/dev/zero of=${localSMNTPT}/pupswap.swp bs=1048576 count=$SWPSIZE
to create an empty file

and
Code:
mkswap ${localSMNTPT}/pupswap.swp
to create the swap file system;

where localSMNTPT could be something like localSMNTPT=/mnt/sda2

bs=1048576 Bytes =1024 KiloBytes KiB =1MiB

SWPSIZE=256 for 256 MiB if bs=1048576

*

To activate the swapfile :
Code:
swapon /mnt/sda2/pupswap.swp
*
NOTE : Code is from Puppy Linux 4 series /etc/rc.d/rc.shutdown
 
1 members found this post helpful.
Old 07-29-2012, 05:26 AM   #4
David the H.
Bash Guru
 
Registered: Jun 2004
Location: Osaka, Japan
Distribution: Arch + Xfce
Posts: 6,852

Rep: Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037
"swap space" is simply an hdd-based filesystem that acts as virtual RAM memory, which the OS can fall back to using when it gets low on actual RAM.

You can choose to set up a swap filesystem on a dedicated partition of its own, or as a virtual partition in a file existing on a regular storage partition (a "swap file"). It's your choice which you want to use, although most *nix users appear to prefer partitions.

You can even have multiple swap spaces of either kind; all activated swap space is combined into one bank of virtual memory.
 
1 members found this post helpful.
Old 07-29-2012, 12:03 PM   #5
jefro
Moderator
 
Registered: Mar 2008
Posts: 21,993

Rep: Reputation: 3628Reputation: 3628Reputation: 3628Reputation: 3628Reputation: 3628Reputation: 3628Reputation: 3628Reputation: 3628Reputation: 3628Reputation: 3628Reputation: 3628
Originally a swap partition was the only way to extend ram. Ram was very expensive and using part of the hard drive helped save money.

Later it was discovered that a swap file could be used to help provide options to the admin. Those options may include ease of changing files, file location and size. About the single drawback is the ability to hibernate to a file.

Files and partitions can be added together to form a single space or used in some priority scheme to use one before the other.
 
1 members found this post helpful.
  


Reply



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
[SOLVED] Difference between Swap and Paging space ?? vikas027 Linux - General 3 09-02-2008 12:00 AM
swap file or swap space? simonb1975uk Linux - General 11 08-15-2008 02:39 PM
swap space (or) swap file yusufs Linux - Newbie 8 07-17-2008 02:02 AM
How to unmount actual swap and mount a new(bigger) swap space? isaac Linux - Newbie 1 06-06-2004 01:23 AM
Difference between Swap Virtrual memory and Swap Parition Nappa Slackware 4 11-27-2003 07:58 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 02:53 AM.

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