LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Enterprise (https://www.linuxquestions.org/questions/linux-enterprise-47/)
-   -   swap file ??? (https://www.linuxquestions.org/questions/linux-enterprise-47/swap-file-533225/)

sachin1361 02-28-2007 06:05 AM

swap file ???
 
can anybody tell me how to create a new swap file after linux enterprise server is installed ...

this is the order of commands:

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


entry in /etc/fstab file
/swapfile swap swap defaults 0 0

system reboot
when I run these commands, in the following order:

#cat /proc/swaps (display the new file)

#free (size increased)

#fdisk -l (no size increased)



after that I again created a new swap file , with name 'swaps', same procedure , system restarted, again run testing commands to check if swap file is created. But only new file is displaying (swaps)

where is the old file(swap)

syg00 02-28-2007 06:15 AM

Are you adding entries to fstab for every swapfile ???.
fdisk won't show the swaps unless they are partitions.

sachin1361 02-28-2007 06:30 AM

swap
 
entry in /etc/fstab file
/swapfile swap swap defaults 0 0


these are the fstab enteries....

pl tell me if swap partition should always be created on new partition or can we use the existing too..

the commands described earlier was from some docs... but I am very confused

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

/dev/zero ...means ???? when I run these command, should i enter the same path or should i give /dev/sda1 or so on

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

/swapfile ......means ??if it denotes that swap file is created on / (root)

syg00 02-28-2007 06:36 AM

Create your swapfiles as /swapfile, /swapfile2, /swapfile3 ... etc.
You will need an entry in fstab for each one.
If you use partitions instead, you don't need to use the dd command - mkswap followed by swapon is sufficient. You will still need an entry for each in fstab to ensure they get mounted on boot.

sachin1361 02-28-2007 06:39 AM

swap
 
pl tell me the format of that entry an d if I wanted to create a new swap file in say, /dev/sda5 , them how the following line will be modified :

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

syg00 02-28-2007 06:46 AM

Something like the following will assign 2 swap partitions - note I use the priority option to ensure the swaps will get used concurrently (a psuedo swap stripe set). See man fstab.
Code:

/dev/hda3      none            swap    pri=1,sw              0      0
/dev/hda4      none            swap    pri=1,sw              0      0


sachin1361 02-28-2007 07:03 AM

swap
 
i think the code you provided will work when we use a new partition .. but in my scenario I am using the swap file ...

so how to make the changes ?

and


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


where should i mention the location of new swap file in above command


All times are GMT -5. The time now is 05:57 AM.