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

Tue Jul 6 14:53:54 UTC 2010
Robert Heller <heller at deepsoft.com>

At Tue, 6 Jul 2010 10:01:10 -0400 CentOS mailing list <centos at 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 at 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
heller at deepsoft.com       -- http://www.deepsoft.com/ModelRailroadSystem/