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?
2010/7/6 Tang Jianwei myhnet@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
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
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.
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
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....
On Tue, Jul 6, 2010 at 10:01 AM, m.roth@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
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.roth@5-cent.us mailto:m.roth@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
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.roth@5-cent.us mailto:m.roth@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
On Tue, Jul 06, 2010 at 10:14:19AM -0400, John Kennedy wrote:
On Tue, Jul 6, 2010 at 10:01 AM, m.roth@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
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