the phrygian cap


luisbg

@luisbg

luis@debethencourt.com

about me

Blogalia
Subscribe with Bloglines
Ohloh profile for Luis de Bethencourt



<Mayo 2013
Lu Ma Mi Ju Vi Sa Do
    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    
             

Creative Commons License



planet ubuntu
alberto ruiz
andy wingo
jeff fortin



"all religions, arts and sciences are branches of the same tree. all these aspirations are directed toward ennobling man's life, lifting it from the sphere of mere physical existence and leading the individual towards freedom." albert einstein

add some swap on the fly



There is no real benefit of using a designated hard drive partition for your swap. You can just use a file, with the benefit this swap space can be temporary or permanent. So if this is a new system or you just need a bit more swap memory for a while, it is very simple, this is what you do:

[1] su -
[2] dd if=/dev/zero of=/swap1 bs=1M count=1024
[3] mkswap /swap1
[4] chmod 600 /swap1
[5] swapon /swap1

bam! that's it. so here it what just happened...
[1] log in as root
[2] create a 1 GB swap file in /swap1
[3] set up a Linux swap area on the file /swap1
[4] set permissions so users can't try reading sensible data from the swap file
[5] start using the swap file

If you want this file to be used for swapping across reboots (permanently), then enter the following line in the /etc/fstab file:
/swap1   swap   swap   defaults   0   0

If you finished the memory intensive task and want the space used for swap back, then use the following command:
swapoff /swap1

Happy hacking! :)

3 Comentarios


Referencias (TrackBacks)

URL de trackback de esta historia http://luisbg.blogalia.com//trackbacks/70203

Comentarios

1
De: Andres G. Aragoneses Fecha: 2011-08-04 12:47

Cool, do you know any distro that does this out of the box?



2
De: desrt Fecha: 2011-08-04 12:59

Use the 'fallocate' command.



3
De: nona Fecha: 2011-08-04 13:53

I know it's probably silly, but I feel a bit uneasy having swap go through:
filesystem (ext4) -> dm-crypt -> lvm -> md -> disk



Nombre
Correo-e
URL
Dirección IP: 23.20.196.179 (e3470cac07)
Comentario

©2007-2013 luis de bethencourt guimera
powered by Blogalia