Difference between revisions of "Swap prin NFS"
From linux360
(11 intermediate revisions by 8 users not shown) | |||
Line 1: | Line 1: | ||
− | Acest articol explica modul in care se poate face swapping atunci cand Linux-ul dvs boot-eaza prin NFS, iar kernel-ul nu are | + | Acest articol explica modul in care se poate face swapping atunci cand Linux-ul dvs boot-eaza prin NFS, iar kernel-ul nu are [http://nfs-swap.dot-heine.de/ patch-ul pentru swap prin NFS]. |
Incepem: | Incepem: | ||
− | + | # cd / | |
− | # cd / | + | # dd if=/dev/zero of=swapfile bs=1M count=X |
− | # dd if=/dev/zero of=swapfile bs=1M count=X | + | |
− | |||
X este o valoare exprimata in MB (de aceea am dat bs=1M) putin mai mare decat valoarea swap-ului pe care vrem sa il cream... De exemplu, pentru un swap de 256 MB, recomand ca X sa fie 270. | X este o valoare exprimata in MB (de aceea am dat bs=1M) putin mai mare decat valoarea swap-ului pe care vrem sa il cream... De exemplu, pentru un swap de 256 MB, recomand ca X sa fie 270. | ||
Transformam fisierul swapfile in sistem de fisiere ext3: | Transformam fisierul swapfile in sistem de fisiere ext3: | ||
− | + | ||
− | # mkfs.ext3 /swapfile | + | # mkfs.ext3 /swapfile |
− | + | /swapfile is not a block special device. | |
− | + | Proceed anyway? (y,n) | |
− | /swapfile is not a block special device. | + | |
− | Proceed anyway? (y,n) | ||
− | |||
mkfs.ext3 are dreptate! Dar continuam, apasand y. | mkfs.ext3 are dreptate! Dar continuam, apasand y. | ||
Cand e gata, cream un director si montam sistemul de fisiere nou creat acolo: | Cand e gata, cream un director si montam sistemul de fisiere nou creat acolo: | ||
− | + | ||
− | # mkdir swap | + | # mkdir swap |
− | # mount swapfile /swap -o loop | + | # mount swapfile /swap -o loop |
− | # cd /swap | + | # cd /swap |
− | + | ||
Sa vedem cat spatiu liber avem pentru a crea fisierul de swap: | Sa vedem cat spatiu liber avem pentru a crea fisierul de swap: | ||
− | + | ||
− | # df -h | + | # df -h |
− | + | ||
Se observa ca spatiu liber de pe /swap e mai mic decat acel X de care vorbeam mai sus... | Se observa ca spatiu liber de pe /swap e mai mic decat acel X de care vorbeam mai sus... | ||
− | + | ||
− | # dd if=/dev/zero of=myswap bs=1M count=Y | + | # dd if=/dev/zero of=myswap bs=1M count=Y |
− | + | ||
Cream fisierul de swap in /swap, Y fiind o valoare in MB mai mica sau egala cu spatiu liber ramas in /swap. | Cream fisierul de swap in /swap, Y fiind o valoare in MB mai mica sau egala cu spatiu liber ramas in /swap. | ||
− | + | ||
− | # mkswap myswap | + | # mkswap myswap |
− | + | ||
Acum avem swap... | Acum avem swap... | ||
− | + | ||
− | # swapon /swap/myswap | + | # swapon /swap/myswap |
− | + | ||
... iar acum il si folosim... Pe bune: | ... iar acum il si folosim... Pe bune: | ||
− | + | ||
− | # free -m | + | # free -m |
− | + | ||
Adaugati-l in /etc/fstab: | Adaugati-l in /etc/fstab: | ||
− | + | ||
− | /swapfile /swap ext3 loop 0 0 | + | /swapfile /swap ext3 loop 0 0 |
− | /swap/myswap swap swap defaults 0 0 | + | /swap/myswap swap swap defaults 0 0 |
− | + | ||
[[Category:HowTo]] | [[Category:HowTo]] | ||
− | [[Category:Tips'n' | + | [[Category:Filesystems]] |
+ | [[Category:Networking]] | ||
+ | [[Category:Tips'n'Tricks]] |
Latest revision as of 09:13, 12 April 2006
Acest articol explica modul in care se poate face swapping atunci cand Linux-ul dvs boot-eaza prin NFS, iar kernel-ul nu are patch-ul pentru swap prin NFS.
Incepem:
# cd / # dd if=/dev/zero of=swapfile bs=1M count=X
X este o valoare exprimata in MB (de aceea am dat bs=1M) putin mai mare decat valoarea swap-ului pe care vrem sa il cream... De exemplu, pentru un swap de 256 MB, recomand ca X sa fie 270. Transformam fisierul swapfile in sistem de fisiere ext3:
# mkfs.ext3 /swapfile /swapfile is not a block special device. Proceed anyway? (y,n)
mkfs.ext3 are dreptate! Dar continuam, apasand y. Cand e gata, cream un director si montam sistemul de fisiere nou creat acolo:
# mkdir swap # mount swapfile /swap -o loop # cd /swap
Sa vedem cat spatiu liber avem pentru a crea fisierul de swap:
# df -h
Se observa ca spatiu liber de pe /swap e mai mic decat acel X de care vorbeam mai sus...
# dd if=/dev/zero of=myswap bs=1M count=Y
Cream fisierul de swap in /swap, Y fiind o valoare in MB mai mica sau egala cu spatiu liber ramas in /swap.
# mkswap myswap
Acum avem swap...
# swapon /swap/myswap
... iar acum il si folosim... Pe bune:
# free -m
Adaugati-l in /etc/fstab:
/swapfile /swap ext3 loop 0 0 /swap/myswap swap swap defaults 0 0