Linux swap file

| | Comments (0)

一般 linux 的 swap 都是割一塊分割區
其實也可以 swap file 的方式

如: 造一個 500MB 的 swap file in /tmp/swapfile
dd bs=1048576 count=500 if=/dev/zero of=/tmp/swapfile
mkswap /tmp/swapfile
swapon /tmp/swapfile

進一步加到 /etc/fstab
/tmp/swapfile swap swap defaults 0 0

ref. man mkswap

To setup a swap file, it is necessary to create that file before ini-
tializing it with mkswap , e.g. using a command like

# dd if=/dev/zero of=swapfile bs=1024 count=65536

Note that a swap file must not contain any holes (so, using cp(1) to
create the file is not acceptable).

Leave a comment

March 2009

Sun Mon Tue Wed Thu Fri Sat
1 2 3 4 5 6 7
8 9 10 11 12 13 14
15 16 17 18 19 20 21
22 23 24 25 26 27 28
29 30 31        

About this Entry

This page contains a single entry by Pank published on July 15, 2004 12:55 AM.

screen was the previous entry in this blog.

PHP memory_limit remote vulnerability is the next entry in this blog.

Find recent content on the main index or look in the archives to find all content.