[转]SWAP分区太小了怎么办?
[oracle@flynet mail]$ <wbr style="LINE-HEIGHT: 1.3em"><font style="LINE-HEIGHT: 1.3em" color="#0000ff"><font size="2"><font style="FONT-SIZE: x-small; LINE-HEIGHT: 1.3em">su - root </font><wbr style="LINE-HEIGHT: 1.3em"><br></wbr></font></font><wbr style="LINE-HEIGHT: 1.3em"><font size="2"><font style="FONT-SIZE: x-small; LINE-HEIGHT: 1.3em">Password: </font><wbr style="LINE-HEIGHT: 1.3em"><br><font style="FONT-SIZE: x-small; LINE-HEIGHT: 1.3em">[root@flynet ~]# </font><wbr style="LINE-HEIGHT: 1.3em"></wbr></wbr></font><font style="LINE-HEIGHT: 1.3em" color="#0000ff"><font size="2"><font style="FONT-SIZE: x-small; LINE-HEIGHT: 1.3em">swapon -s </font><wbr style="LINE-HEIGHT: 1.3em"><br></wbr></font></font><wbr style="LINE-HEIGHT: 1.3em"><font size="2"><font style="FONT-SIZE: x-small; LINE-HEIGHT: 1.3em">FilenameTypeSizeUsedPriority </font><wbr style="LINE-HEIGHT: 1.3em"><br><font style="FONT-SIZE: x-small; LINE-HEIGHT: 1.3em">/dev/sda2 partition 4096480 -1 </font><wbr style="LINE-HEIGHT: 1.3em"><br><font style="FONT-SIZE: x-small; LINE-HEIGHT: 1.3em">[root@flynet ~]# <font style="LINE-HEIGHT: 1.3em" color="#0000ff">df -h</font><wbr style="LINE-HEIGHT: 1.3em"></wbr></font><wbr style="LINE-HEIGHT: 1.3em"><br><font style="FONT-SIZE: x-small; LINE-HEIGHT: 1.3em">FilesystemSizeUsed Avail Use% Mounted on </font><wbr style="LINE-HEIGHT: 1.3em"><br><font style="FONT-SIZE: x-small; LINE-HEIGHT: 1.3em">/dev/sda3 268G 49G205G20% / </font><wbr style="LINE-HEIGHT: 1.3em"><br><font style="FONT-SIZE: x-small; LINE-HEIGHT: 1.3em">/dev/sda199M 13M 81M14% /boot </font><wbr style="LINE-HEIGHT: 1.3em"><br><font style="FONT-SIZE: x-small; LINE-HEIGHT: 1.3em">none2.0G 02.0G 0% /dev/shm </font><wbr style="LINE-HEIGHT: 1.3em"><br><font style="FONT-SIZE: x-small; LINE-HEIGHT: 1.3em">[root@flynet ~]# <font style="LINE-HEIGHT: 1.3em" color="#0000ff">free -m</font><wbr style="LINE-HEIGHT: 1.3em"></wbr></font><wbr style="LINE-HEIGHT: 1.3em"><br><font style="FONT-SIZE: x-small; LINE-HEIGHT: 1.3em"> total used free sharedbuffers cached </font><wbr style="LINE-HEIGHT: 1.3em"><br><font style="FONT-SIZE: x-small; LINE-HEIGHT: 1.3em">Mem:3946888 30580 32660 </font><wbr style="LINE-HEIGHT: 1.3em"><br><font style="FONT-SIZE: x-small; LINE-HEIGHT: 1.3em">-/+ buffers/cache:195 3751 </font><wbr style="LINE-HEIGHT: 1.3em"><br><font style="FONT-SIZE: x-small; LINE-HEIGHT: 1.3em">Swap:4000400 </font><wbr style="LINE-HEIGHT: 1.3em"><br></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></font><font style="LINE-HEIGHT: 1.3em" color="#ff0000"><font style="FONT-SIZE: x-small; LINE-HEIGHT: 1.3em"><b><wbr><font size="2">第一步:新建一个空白文件:</font></wbr></b><wbr><font size="2"> </font></wbr></font><wbr style="LINE-HEIGHT: 1.3em"><br></wbr></font><wbr style="LINE-HEIGHT: 1.3em"><font size="2"><font style="FONT-SIZE: x-small; LINE-HEIGHT: 1.3em">[root@flynet ~]# <font style="LINE-HEIGHT: 1.3em" color="#0000ff">dd if=/dev/zero of=/var/swapfile bs=1024 count=7979008</font><wbr style="LINE-HEIGHT: 1.3em"></wbr></font><wbr style="LINE-HEIGHT: 1.3em"><br><font style="FONT-SIZE: x-small; LINE-HEIGHT: 1.3em">7979008+0 records in </font><wbr style="LINE-HEIGHT: 1.3em"><br><font style="FONT-SIZE: x-small; LINE-HEIGHT: 1.3em">7979008+0 records out </font><wbr style="LINE-HEIGHT: 1.3em"><br></wbr></wbr></wbr></font><font style="FONT-SIZE: x-small; LINE-HEIGHT: 1.3em"><font style="LINE-HEIGHT: 1.3em" color="#ff0000"><b><wbr><font size="2">第二步:然后格式化成swap格式:</font></wbr></b><wbr></wbr></font><wbr style="LINE-HEIGHT: 1.3em"><font size="2"> </font></wbr></font><wbr style="LINE-HEIGHT: 1.3em"><br><font style="FONT-SIZE: x-small; LINE-HEIGHT: 1.3em" size="2">[root@flynet ~]# </font><wbr style="LINE-HEIGHT: 1.3em"><font style="LINE-HEIGHT: 1.3em" color="#0000ff"><font size="2"><font style="FONT-SIZE: x-small; LINE-HEIGHT: 1.3em">mkswap /var/swapfile </font><wbr style="LINE-HEIGHT: 1.3em"><br></wbr></font></font><wbr style="LINE-HEIGHT: 1.3em"><font size="2"><font style="FONT-SIZE: x-small; LINE-HEIGHT: 1.3em">Setting up swapspace version 1, size = 8170500 kB </font><wbr style="LINE-HEIGHT: 1.3em"><br></wbr></font><font style="FONT-SIZE: x-small; LINE-HEIGHT: 1.3em"><font style="LINE-HEIGHT: 1.3em" color="#ff0000"><b><wbr><font size="2">第三步:加载swap文件:</font></wbr></b><wbr></wbr></font><wbr style="LINE-HEIGHT: 1.3em"><font size="2"> </font></wbr></font><wbr style="LINE-HEIGHT: 1.3em"><br><font size="2"><font style="FONT-SIZE: x-small; LINE-HEIGHT: 1.3em">[root@flynet ~]# <font style="LINE-HEIGHT: 1.3em" color="#0000ff">swapon /var/swapfile</font><wbr style="LINE-HEIGHT: 1.3em"></wbr></font><wbr style="LINE-HEIGHT: 1.3em"><br></wbr></font><b><wbr><font style="LINE-HEIGHT: 1.3em" color="#ff0000"><font size="2"><font style="FONT-SIZE: x-small; LINE-HEIGHT: 1.3em">第四步:编辑/etc/fstab,增加如下内容: </font><wbr style="LINE-HEIGHT: 1.3em"><br></wbr></font></font><wbr style="LINE-HEIGHT: 1.3em"></wbr></wbr></b><wbr><font size="2"><font style="FONT-SIZE: x-small; LINE-HEIGHT: 1.3em">[root@flynet ~]# <font style="LINE-HEIGHT: 1.3em" color="#0000ff">vi /etc/fstab</font><wbr style="LINE-HEIGHT: 1.3em"></wbr></font><wbr style="LINE-HEIGHT: 1.3em"><br><font style="FONT-SIZE: x-small; LINE-HEIGHT: 1.3em"># This file is edited by fstab-sync - see 'man fstab-sync' for details </font><wbr style="LINE-HEIGHT: 1.3em"><br><font style="FONT-SIZE: x-small; LINE-HEIGHT: 1.3em">LABEL=/ / ext3defaults1 1 </font><wbr style="LINE-HEIGHT: 1.3em"><br><font style="FONT-SIZE: x-small; LINE-HEIGHT: 1.3em">LABEL=/boot /boot ext3defaults1 2 </font><wbr style="LINE-HEIGHT: 1.3em"><br><font style="FONT-SIZE: x-small; LINE-HEIGHT: 1.3em">none/dev/ptsdevptsgid=5,mode=6200 0 </font><wbr style="LINE-HEIGHT: 1.3em"><br><font style="FONT-SIZE: x-small; LINE-HEIGHT: 1.3em">none/dev/shmtmpfs defaults0 0 </font><wbr style="LINE-HEIGHT: 1.3em"><br><font style="FONT-SIZE: x-small; LINE-HEIGHT: 1.3em">none/proc procdefaults0 0 </font><wbr style="LINE-HEIGHT: 1.3em"><br><font style="FONT-SIZE: x-small; LINE-HEIGHT: 1.3em">none/syssysfs defaults0 0 </font><wbr style="LINE-HEIGHT: 1.3em"><br><font style="FONT-SIZE: x-small; LINE-HEIGHT: 1.3em">LABEL=SWAP-sda2 swapswapdefaults0 0 </font><wbr style="LINE-HEIGHT: 1.3em"><br><font style="FONT-SIZE: x-small; LINE-HEIGHT: 1.3em"><font style="LINE-HEIGHT: 1.3em" color="#0000ff">/var/swapfile noneswapsw0 0</font><wbr style="LINE-HEIGHT: 1.3em"></wbr></font><wbr style="LINE-HEIGHT: 1.3em"><br><font style="FONT-SIZE: x-small; LINE-HEIGHT: 1.3em">/dev/hda/media/cdromautopamconsole,fscontext=system_u:object_r:removable_t,exec,noauto,managed 0 0 </font><wbr style="LINE-HEIGHT: 1.3em"><br><font style="FONT-SIZE: x-small; LINE-HEIGHT: 1.3em">~ </font><wbr style="LINE-HEIGHT: 1.3em"><br><font style="FONT-SIZE: x-small; LINE-HEIGHT: 1.3em">~ </font><wbr style="LINE-HEIGHT: 1.3em"><br><font style="FONT-SIZE: x-small; LINE-HEIGHT: 1.3em">~ </font><wbr style="LINE-HEIGHT: 1.3em"><br><font style="FONT-SIZE: x-small; LINE-HEIGHT: 1.3em">"/etc/fstab" 10L, 803C written </font><wbr style="LINE-HEIGHT: 1.3em"><br><br></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></font><font style="LINE-HEIGHT: 1.3em" color="#ff0000"><b><wbr><font size="2"><font style="FONT-SIZE: x-small; LINE-HEIGHT: 1.3em">查看一下更改后情况: </font><wbr style="LINE-HEIGHT: 1.3em"><br></wbr></font></wbr></b><wbr></wbr></font><wbr style="LINE-HEIGHT: 1.3em"><font size="2"><font style="FONT-SIZE: x-small; LINE-HEIGHT: 1.3em">[root@flynet ~]# <font style="LINE-HEIGHT: 1.3em" color="#0000ff">swapon -s</font><wbr style="LINE-HEIGHT: 1.3em"></wbr></font><wbr style="LINE-HEIGHT: 1.3em"><br><font style="FONT-SIZE: x-small; LINE-HEIGHT: 1.3em">FilenameTypeSizeUsedPriority </font><wbr style="LINE-HEIGHT: 1.3em"><br><font style="FONT-SIZE: x-small; LINE-HEIGHT: 1.3em">/dev/sda2 partition 40964869684 -1 </font><wbr style="LINE-HEIGHT: 1.3em"><br><font style="FONT-SIZE: x-small; LINE-HEIGHT: 1.3em">/var/swapfile file7979000 0 -2 </font><wbr style="LINE-HEIGHT: 1.3em"><br><font style="FONT-SIZE: x-small; LINE-HEIGHT: 1.3em">[oracle@flynet mail]$ <font style="LINE-HEIGHT: 1.3em" color="#0000ff">free -m</font><wbr style="LINE-HEIGHT: 1.3em"></wbr></font><wbr style="LINE-HEIGHT: 1.3em"><br><font style="FONT-SIZE: x-small; LINE-HEIGHT: 1.3em"> total used free sharedbuffers cached </font><wbr style="LINE-HEIGHT: 1.3em"><br><font style="FONT-SIZE: x-small; LINE-HEIGHT: 1.3em">Mem:3946 3906 400 11 3610 </font><wbr style="LINE-HEIGHT: 1.3em"><br><font style="FONT-SIZE: x-small; LINE-HEIGHT: 1.3em">-/+ buffers/cache:284 3662 </font><wbr style="LINE-HEIGHT: 1.3em"><br><font style="FONT-SIZE: x-small; LINE-HEIGHT: 1.3em">Swap: 8192 67 8124 </font><wbr style="LINE-HEIGHT: 1.3em"><br><font style="FONT-SIZE: x-small; LINE-HEIGHT: 1.3em">[oracle@flynet mail]$ <font style="LINE-HEIGHT: 1.3em" color="#0000ff">df -h</font><wbr style="LINE-HEIGHT: 1.3em"></wbr></font><wbr style="LINE-HEIGHT: 1.3em"><br><font style="FONT-SIZE: x-small; LINE-HEIGHT: 1.3em">FilesystemSizeUsed Avail Use% Mounted on </font><wbr style="LINE-HEIGHT: 1.3em"><br><font style="FONT-SIZE: x-small; LINE-HEIGHT: 1.3em">/dev/sda3 268G 57G198G23% / </font><wbr style="LINE-HEIGHT: 1.3em"><br><font style="FONT-SIZE: x-small; LINE-HEIGHT: 1.3em">/dev/sda199M 13M 81M14% /boot </font><wbr style="LINE-HEIGHT: 1.3em"><br><font style="FONT-SIZE: x-small; LINE-HEIGHT: 1.3em">none2.0G 02.0G 0% /dev/shm </font></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></font><wbr style="LINE-HEIGHT: 1.3em"><br></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr>
|