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

Re: Installing with no swap partition



In <[🔎] 631fe46c0907271429n387f32bp42606b1755eae193@mail.gmail.com>, Mark wrote:
>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

1024 x 65536 = 1Ki x 64Ki = 64Mi.

So, that would make a 64M swap file.

I'd use:
dd if=/dev/zero of=/swapfile bs=$((1 << 12)) count=$((1 << 18))

(1 << 12) x (1 << 18) = (1 << 30) = 1GiB. [1]

>And would the correct use of mkswap be:
>
># mkswap /swapfile

You can specify a label if you like.  Otherwise, good.

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

Looks good.
-- 
Boyd Stephen Smith Jr.           	 ,= ,-_-. =.
bss@iguanasuicide.net            	((_/)o o(\_))
ICQ: 514984 YM/AIM: DaTwinkDaddy 	 `-'(. .)`-'
http://iguanasuicide.net/        	     \_/

[1] (x << y) means x*(2^y). So, (1 << 10) = 1Ki; (1 << 20) = 1Mi; (1 << 30) 
= 1Gi.

Attachment: signature.asc
Description: This is a digitally signed message part.


Reply to: