Chinaunix
标题:
利用file文件增加swap大小(开机自动挂载)
[打印本页]
作者:
shineboy816
时间:
2009-03-16 10:27
标题:
利用file文件增加swap大小(开机自动挂载)
swap大小不够,但是要临时增加swap的大小,可以在某个目录下创建文件,增加到swap空间,下面以在/opt目录下创建swapfile文件为列!
1.创建一个500M的空白文件 /opt/swapfile :
[root@airwayORA ~]# dd if=/dev/zero of=/opt/swapfile bs=1M count=500
500+0 records in
500+0 records out
2.mkswap是在那个空白文件的基础上,建立swap的文件系统。
[root@airwayORA opt]# mkswap swapfile
Setting up swapspace version 1, size = 524283 kB
3.查看现有swap大小:
[root@airwayORA opt]# free -m
total used free shared buffers cached
Mem: 2026 1091 935 0 61 861
-/+ buffers/cache: 168 1858
Swap: 4094 0 4094
4.激活swapfile文件:
[root@airwayORA opt]# swapon swapfile
5.查看swap的大小
[root@airwayORA opt]# free -m
total used free shared buffers cached
Mem: 2026 1091 934 0 61 861
-/+ buffers/cache: 168 1857
Swap: 4594 0 4594
6.在/etc/fstab文件中中增加信息,使开机能自动挂载文件。
[root@airwayORA ~]#vi /etc/fstab
# This file is edited by fstab-sync - see 'man fstab-sync' for details
/dev/VolGroup00/LogVol00 / ext3 defaults 1 1
LABEL=/boot /boot ext3 defaults 1 2
none /dev/pts devpts gid=5,mode=620 0 0
none /dev/shm tmpfs defaults 0 0
/dev/VolGroup00/LogVol01 /home ext3 defaults 1 2
/dev/VolGroup00/LogVol04 /opt ext3 defaults 1 2
none /proc proc defaults 0 0
none /sys sysfs defaults 0 0
/dev/VolGroup00/LogVol02 /tmp ext3 defaults 1 2
/dev/VolGroup00/LogVol03 /usr/local ext3 defaults 1 2
LABEL=SWAP-sda3 swap swap defaults 0 0
/opt/swapfile swap swap defaults 0 0
ps:
/opt/swapfile 为挂载的源文件路径
swap(第2行) 为挂载的目的路径(swap为特殊的分区,不是个目录)
swap (第3行) 为文件的类型
本文来自ChinaUnix博客,如果查看原文请点:
http://blog.chinaunix.net/u2/70777/showart_1864509.html
作者:
huqinwei987
时间:
2013-12-01 20:50
最后那一整段都是要自己手写进去的么?手写进去怎么生效,还是只是文本?
插入到什么位置?如果已经有这个文件
作者:
huqinwei987
时间:
2013-12-01 20:55
# /etc/fstab: static file system information.
#
# Use 'blkid -o value -s UUID' to print the universally unique identifier
# for a device; this may be used with UUID= as a more robust way to name
# devices that works even if disks are added and removed. See fstab(5).
#
# <file system> <mount point> <type> <options> <dump> <pass>
proc /proc proc nodev,noexec,nosuid 0 0
# / was on /dev/sda1 during installation
UUID=ff62298c-f866-4a5d-bcd7-e895dadbe3c6 / ext4 errors=remount-ro 0 1
# swap was on /dev/sda5 during installation
UUID=01b4e1f2-19e5-4a15-a18c-48d5d762b2bc none swap sw 0 0
/dev/fd0 /media/floppy0 auto rw,user,noauto,exec,utf8 0 0
/dev/sda3 /media/sda3 ext4 rw,user 0 0
~
~
复制代码
欢迎光临 Chinaunix (http://bbs.chinaunix.net/)
Powered by Discuz! X3.2