[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Installing with no swap partition



I like this idea of using a swap file instead of partition (for both my Debian and Ubuntu machines).  Is the following code correct for creating the swap file (assuming 1 GB swap file size)?
# dd if=/dev/zero of=/swapfile bs=1024 count=65536
And would the correct use of mkswap be:

# mkswap /swapfile

Then add this to /etc/fstab:
# /swapfile               swap                    swap    defaults        0 0

Thanks,
Mark

On Mon, Jul 27, 2009 at 2:09 PM, Boyd Stephen Smith Jr. <bss@iguanasuicide.net> wrote:
In <[🔎] 631fe46c0907271347g341e048udf74d5ee643e1a5b@mail.gmail.com">[🔎] 631fe46c0907271347g341e048udf74d5ee643e1a5b@mail.gmail.com>, Mark wrote:
>A couple of questions (background is below the questions if you want to
>read):
>
>Question 1: In the Debian manual it says a swap partition isn't needed but
>recommended for efficiency.  Anyone else installed without swap and had
>success?

>Is my installation a ticking time bomb if I don't have a swap
>partition?

Usually, no.  Either the OOM killer will kick in or malloc/calloc/realloc
will start failing earlier, so you might want to add swap if either of those
happens.  You'll get OOM messages in /var/log/messages; applications will
either crash or notify you they are out of memory if malloc/calloc/realloc
fails.

You can use a swap file instead of a swap partition/disk.  Just create a
file of the appropriate size with dd, use mkfs.swap on it, and add it to
your fstab.
--
Boyd Stephen Smith Jr.                   ,= ,-_-. =.
bss@iguanasuicide.net                   ((_/)o o(\_))
ICQ: 514984 YM/AIM: DaTwinkDaddy         `-'(. .)`-'
http://iguanasuicide.net/                    \_/



Reply to: