[CentOS] why i can not put my swap files in /dev?

2010-07-06 Thread Tang Jianwei
I tried to create some swap files in /dev directory for my desktop.
the dd and mkswap were ok. but when I try to swapon it, i get this:

# swapon /dev/myswap
swapon: /dev/myswap: Invalid argument

but when I mv the file to some other directory like /mnt or /, the 
swapon works.

could sb. tell me why?

-- 
Tang Jianwei

___
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos


Re: [CentOS] why i can not put my swap files in /dev?

2010-07-06 Thread Eero Volotinen
2010/7/6 Tang Jianwei myh...@gmail.com:
 I tried to create some swap files in /dev directory for my desktop.
 the dd and mkswap were ok. but when I try to swapon it, i get this:

 # swapon /dev/myswap
 swapon: /dev/myswap: Invalid argument

 but when I mv the file to some other directory like /mnt or /, the
 swapon works.

/dev/* is virtual directory containing all devices, not files. create
your swap on disk devices (/dev/sdXX, not in empty space)

--
Eero,
RHCE
___
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos


Re: [CentOS] why i can not put my swap files in /dev?

2010-07-06 Thread Mogens Kjaer
On 07/06/2010 12:41 PM, Tang Jianwei wrote:
 I tried to create some swap files in /dev directory for my desktop.
 the dd and mkswap were ok.

Does the file exist after reboot?

I think the /dev directory is made in a RAM disk
(tmpfs), not a useful place to put a swapfile.

Mogens

-- 
Mogens Kjaer, m...@lemo.dk
http://www.lemo.dk
___
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos


Re: [CentOS] why i can not put my swap files in /dev?

2010-07-06 Thread Tang Jianwei

Thank you and Mogens. and I also think this is the cause.

Tang Jianwei


On 07/06/2010 06:50 PM, Eero Volotinen wrote:

/dev/* is virtual directory containing all devices, not files. create
your swap on disk devices (/dev/sdXX, not in empty space)
   
___
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos


Re: [CentOS] why i can not put my swap files in /dev?

2010-07-06 Thread Robert Heller
At Tue, 06 Jul 2010 18:41:06 +0800 CentOS mailing list centos@centos.org 
wrote:

 
 I tried to create some swap files in /dev directory for my desktop.
 the dd and mkswap were ok. but when I try to swapon it, i get this:
 
 # swapon /dev/myswap
 swapon: /dev/myswap: Invalid argument
 
 but when I mv the file to some other directory like /mnt or /, the 
 swapon works.
 
 could sb. tell me why?

/dev is mounted from a *ramdisk* -- swapping to a RAM disk makes really
no sense.

With a modern (eg 2.6 kernel w/udev), /dev is created fresh at boot time
and only contains device node files, generally created on-the-fly by udevd.

 

-- 
Robert Heller -- Get the Deepwoods Software FireFox Toolbar!
Deepwoods Software-- Linux Installation and Administration
http://www.deepsoft.com/  -- Web Hosting, with CGI and Database
hel...@deepsoft.com   -- Contract Programming: C/C++, Tcl/Tk

  
___
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos


Re: [CentOS] why i can not put my swap files in /dev?

2010-07-06 Thread Jerry McAllister
On Tue, Jul 06, 2010 at 06:41:06PM +0800, Tang Jianwei wrote:

 I tried to create some swap files in /dev directory for my desktop.
 the dd and mkswap were ok. but when I try to swapon it, i get this:
 
 # swapon /dev/myswap
 swapon: /dev/myswap: Invalid argument
 
 but when I mv the file to some other directory like /mnt or /, the 
 swapon works.
 
 could sb. tell me why?

/dev is not a real directory for data files.
You should actually make a separate partition for swap  
Otherwise, you can put it in some real file spaca such as in /usr
or where you left a lot of space.That is often done to increase
available swap space when the originally created  swap  partition
is not large enough - add some from file space.

jerry



 
 -- 
 Tang Jianwei
 
 ___
 CentOS mailing list
 CentOS@centos.org
 http://lists.centos.org/mailman/listinfo/centos
___
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos


Re: [CentOS] why i can not put my swap files in /dev?

2010-07-06 Thread m . roth
Jerry McAllister wrote:
 On Tue, Jul 06, 2010 at 06:41:06PM +0800, Tang Jianwei wrote:

 I tried to create some swap files in /dev directory for my desktop.
 the dd and mkswap were ok. but when I try to swapon it, i get this:

 # swapon /dev/myswap
 swapon: /dev/myswap: Invalid argument

 but when I mv the file to some other directory like /mnt or /, the
 swapon works.

 could sb. tell me why?

Well, /dev is *not* a good place for anything but device files.

 /dev is not a real directory for data files.
snip
Um, er, what do you mean about it not being a real directory?

  mark

--
When I hear about object oriented systems, I think of one that's been
around for about 40 years: *Nix. Everything's a file, er, object, and
you pipe, er, message from one object to another

___
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos


Re: [CentOS] why i can not put my swap files in /dev?

2010-07-06 Thread Tang Jianwei
In the past I only heard that /proc and /sys are RAM directories, now 
I get /dev as well. thank you.


Tang Jianwei


On 07/06/2010 10:14 PM, John Kennedy wrote:



On Tue, Jul 6, 2010 at 10:01 AM, m.r...@5-cent.us 
mailto:m.r...@5-cent.us wrote:


Jerry McAllister wrote:
 On Tue, Jul 06, 2010 at 06:41:06PM +0800, Tang Jianwei wrote:

 I tried to create some swap files in /dev directory for my desktop.
 the dd and mkswap were ok. but when I try to swapon it, i get this:

 # swapon /dev/myswap
 swapon: /dev/myswap: Invalid argument

 but when I mv the file to some other directory like /mnt or /, the
 swapon works.

 could sb. tell me why?

Well, /dev is *not* a good place for anything but device files.

 /dev is not a real directory for data files.
snip
Um, er, what do you mean about it not being a real directory?

 mark


I would say he means real as exists on a hard drive like /home of 
/var as opposed to virtual as exists in RAM like /proc.

John
--
John Kennedy


___
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos
   
___
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos


Re: [CentOS] why i can not put my swap files in /dev?

2010-07-06 Thread Robert Heller
At Tue, 6 Jul 2010 10:01:10 -0400 CentOS mailing list centos@centos.org wrote:

 
 Jerry McAllister wrote:
  On Tue, Jul 06, 2010 at 06:41:06PM +0800, Tang Jianwei wrote:
 
  I tried to create some swap files in /dev directory for my desktop.
  the dd and mkswap were ok. but when I try to swapon it, i get this:
 
  # swapon /dev/myswap
  swapon: /dev/myswap: Invalid argument
 
  but when I mv the file to some other directory like /mnt or /, the
  swapon works.
 
  could sb. tell me why?
 
 Well, /dev is *not* a good place for anything but device files.
 
  /dev is not a real directory for data files.
 snip
 Um, er, what do you mean about it not being a real directory?

It is not 'persistent' across boots.  It is not backed by actual hard
disk space.  Any *data* files (including swap files) will be gone at the
next reboot.  The *device* files are re-created by udevd during the boot
process (and later on by the hotplug / HAL subsystem).

 
   mark
 
 --
 When I hear about object oriented systems, I think of one that's been
 around for about 40 years: *Nix. Everything's a file, er, object, and
 you pipe, er, message from one object to another
 
 ___
 CentOS mailing list
 CentOS@centos.org
 http://lists.centos.org/mailman/listinfo/centos
 
 

-- 
Robert Heller -- 978-544-6933
Deepwoods Software-- Download the Model Railroad System
http://www.deepsoft.com/  -- Binaries for Linux and MS-Windows
hel...@deepsoft.com   -- http://www.deepsoft.com/ModelRailroadSystem/
   
___
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos


Re: [CentOS] why i can not put my swap files in /dev?

2010-07-06 Thread Jerry McAllister
On Tue, Jul 06, 2010 at 10:14:19AM -0400, John Kennedy wrote:

 On Tue, Jul 6, 2010 at 10:01 AM, m.r...@5-cent.us wrote:
 
  Jerry McAllister wrote:
   On Tue, Jul 06, 2010 at 06:41:06PM +0800, Tang Jianwei wrote:
  
   I tried to create some swap files in /dev directory for my desktop.
   the dd and mkswap were ok. but when I try to swapon it, i get this:
  
   # swapon /dev/myswap
   swapon: /dev/myswap: Invalid argument
  
   but when I mv the file to some other directory like /mnt or /, the
   swapon works.
  
   could sb. tell me why?
 
  Well, /dev is *not* a good place for anything but device files.
  
   /dev is not a real directory for data files.
  snip
  Um, er, what do you mean about it not being a real directory?
 
   mark
 
 
 I would say he means real as exists on a hard drive like /home of /var as
 opposed to virtual as exists in RAM like /proc.
 John

Yup.

jerry


 -- 
 John Kennedy

 ___
 CentOS mailing list
 CentOS@centos.org
 http://lists.centos.org/mailman/listinfo/centos

___
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos


Re: [CentOS] why i can not put my swap files in /dev?

2010-07-06 Thread Robert Heller
At Tue, 06 Jul 2010 22:30:10 +0800 CentOS mailing list centos@centos.org 
wrote:

 
 
 
 In the past I only heard that /proc and /sys are RAM directories, now 

/proc and /sys are psuedo directories -- they hook into kernel data structures.

 I get /dev as well. thank you.

With 2.6 kernels and udev, /dev has become a RAMDISK that is freshly
populated at boot time by udevd and related code (HAL and the hotplug
system). 

 
 Tang Jianwei
 
 
 On 07/06/2010 10:14 PM, John Kennedy wrote:
 
 
  On Tue, Jul 6, 2010 at 10:01 AM, m.r...@5-cent.us 
  mailto:m.r...@5-cent.us wrote:
 
  Jerry McAllister wrote:
   On Tue, Jul 06, 2010 at 06:41:06PM +0800, Tang Jianwei wrote:
  
   I tried to create some swap files in /dev directory for my desktop.
   the dd and mkswap were ok. but when I try to swapon it, i get this:
  
   # swapon /dev/myswap
   swapon: /dev/myswap: Invalid argument
  
   but when I mv the file to some other directory like /mnt or /, the
   swapon works.
  
   could sb. tell me why?
 
  Well, /dev is *not* a good place for anything but device files.
  
   /dev is not a real directory for data files.
  snip
  Um, er, what do you mean about it not being a real directory?
 
   mark
 
 
  I would say he means real as exists on a hard drive like /home of 
  /var as opposed to virtual as exists in RAM like /proc.
  John
  -- 
  John Kennedy
 
 
  ___
  CentOS mailing list
  CentOS@centos.org
  http://lists.centos.org/mailman/listinfo/centos
 
 
 MIME-Version: 1.0
 
 ___
 CentOS mailing list
 CentOS@centos.org
 http://lists.centos.org/mailman/listinfo/centos
 
 

-- 
Robert Heller -- 978-544-6933
Deepwoods Software-- Download the Model Railroad System
http://www.deepsoft.com/  -- Binaries for Linux and MS-Windows
hel...@deepsoft.com   -- http://www.deepsoft.com/ModelRailroadSystem/

  
___
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos