LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware > Slackware - Installation
User Name
Password
Slackware - Installation This forum is for the discussion of installation issues with Slackware.

Notices

Reply
 
Search this Thread
Old 03-15-2014, 12:46 AM   #1
stf92
Senior Member
 
Registered: Apr 2007
Location: Buenos Aires.
Distribution: Slackware
Posts: 3,125

Rep: Reputation: 46
How do I know the swap in up and running?


Hi: 'cat /proc/swaps' lists 0 bytes and all permissions removed except read permissions. Character on column 1 of the listing is a '-' (hiphen). Ah, the swap is a regular file.

The file itself is listed (ls) as the other one except it has write permissions for root.

EDIT: I already know. If swapoff does not complain, then it exists and in on.

EDIT: dmesg does not mention the swap. Neither do I find the word in /etc/messages, except for when it was a disk partition!

Last edited by stf92; 03-15-2014 at 12:52 AM.
 
Old 03-15-2014, 01:16 AM   #2
stf92
Senior Member
 
Registered: Apr 2007
Location: Buenos Aires.
Distribution: Slackware
Posts: 3,125

Original Poster
Rep: Reputation: 46
Trying to put some order: 'swapon -s' does not list anything. So, the swap, /SWAP_DO_NOT_TOUCH/SWAPFILE, has not been activated during reboot. But neither there have been anyerror messages during boot, swap related. OK.

How did I created it?
Code:
 'if=/dev/zero of=/SWAP_DO_NOT_TOUCH/SWAPFILE bs=1024 count=512*1024'
and then
Code:
mkswap -c /SWAP_DO_NOT_TOUCH/SWAPFILE
File gives:
Code:
oot@local:~# file /SWAP_NO_TOCAR/SWAPFILE 
/SWAP_NO_TOCAR/SWAPFILE: Linux/i386 swap file (new style) 1 (4K pages) size 131071 pages Label ETIQ_1
root@local:~#
I think the fault is in /etc/fstab:
Code:
UUID="487f65af-9f66-44fe-bb74-f15ad3f29358" /SWAP_NO_TOCAR/SWAPFILE swap defaults  0   0
I'll try 'swap' or 'none' instead of the file name for the second field. The man page for fstab, when speaking of the second field, only refers to special devices, not files.
 
Old 03-15-2014, 02:00 AM   #3
TracyTiger
Member
 
Registered: Apr 2011
Location: California, USA
Distribution: Slackware
Posts: 270

Rep: Reputation: 63
So we can assume that you know that most people use a full partition of type 82 (swap) when creating a swap area. And that you specifically want to use a file in a file system for swap.

... and you've already found the swapon -s command in answer to the title of this thread.

Last edited by TracyTiger; 03-15-2014 at 02:03 AM.
 
Old 03-15-2014, 02:10 AM   #4
stf92
Senior Member
 
Registered: Apr 2007
Location: Buenos Aires.
Distribution: Slackware
Posts: 3,125

Original Poster
Rep: Reputation: 46
Yes, but the most definite proof was provided by 'free -m' which gave total=use=free=0 for swap. I'm doing something wrong.

Last edited by stf92; 03-15-2014 at 02:14 AM.
 
Old 03-15-2014, 03:06 AM   #5
stf92
Senior Member
 
Registered: Apr 2007
Location: Buenos Aires.
Distribution: Slackware
Posts: 3,125

Original Poster
Rep: Reputation: 46
The solution:
Code:
/SWAP_DO_NOT_TOUCH/SWAPFILE swap swap defaults 0 0
in /etc/fstab. The first field is the name of the file, as when we use partitions, we put say /dev/sda4 (the device name). I was using the UUID, following a suggestion in the fstab man page. A thing that as I don't use removable drives as a rule, I have not the least necessity of.

Last edited by stf92; 03-15-2014 at 03:07 AM.
 
Old 03-15-2014, 05:47 AM   #6
273
Senior Member
 
Registered: Dec 2011
Location: UK
Distribution: Debian Sid AMD64, Raspbian Wheezy, various VMs
Posts: 3,377

Rep: Reputation: 782Reputation: 782Reputation: 782Reputation: 782Reputation: 782Reputation: 782Reputation: 782
Yes, when you're referring to a swap (or any other) partition in fstab it's often a good idea to use UUIDs as it prevents problems if the drives are initialised in a different order (which seems to be very common when using a few similar drives) but when referring to a swap file then the filesystem has to be mounted anyhow so you can just use the path on the filesystem. In my case I use the following in fstab for swap:
Code:
/data/swapfile/swap    none    swap    sw    0    0
 
Old 03-15-2014, 12:59 PM   #7
stf92
Senior Member
 
Registered: Apr 2007
Location: Buenos Aires.
Distribution: Slackware
Posts: 3,125

Original Poster
Rep: Reputation: 46
Ahaaa, the fstab does not mention swap files at all, and instead of refering to swap space, which is a general enough word, when it has to refer to the swap it does it as swap partition. This seems to reflect a policy of rejection of the use of files for swap space. Many people think a swap file is accessed as a regular file normally is and ignore the fact that the kernel just uses the space allocated for the file, bypassing caching and filesystem overhead, which would be ridiculous. It just keeps a map of the physical sectors, which are consecutive in the disk if one does things well. However some other man page even gives the concrete example of the use of dd as a means of allocating the space, mentioning the swap file explicitly. Only for large systems the use of a disk or disk partition makes sense. Not certainly for a home computer, despite the indignation of purists. Of course, it's always giving the kernel extra work and goes against the concept of simplicity.
 
  


Reply


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
[SOLVED] Running fstrim manually on a swap partition - can it be done? flokofcgulls Slackware 3 05-31-2013 11:58 AM
How to swap an SCSI controller under a running system. okcomputer44 Linux - Hardware 1 04-27-2009 12:12 PM
how to mount swap partition running livecd? linus72 Linux - Newbie 1 04-12-2009 08:14 PM
Running the swap file out of memory Arbitor Mandriva 5 04-12-2004 02:23 AM
swap space is running out ... yahelb Linux - General 4 03-14-2003 07:43 AM


All times are GMT -5. The time now is 04:00 PM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration