LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Enterprise Linux Forums > Linux - Enterprise
User Name
Password
Linux - Enterprise This forum is for all items relating to using Linux in the Enterprise.

Notices


Reply
  Search this Thread
Old 02-28-2007, 06:05 AM   #1
sachin1361
Member
 
Registered: Feb 2007
Posts: 126

Rep: Reputation: 15
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)
 
Old 02-28-2007, 06:15 AM   #2
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,126

Rep: Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120
Are you adding entries to fstab for every swapfile ???.
fdisk won't show the swaps unless they are partitions.
 
Old 02-28-2007, 06:30 AM   #3
sachin1361
Member
 
Registered: Feb 2007
Posts: 126

Original Poster
Rep: Reputation: 15
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)
 
Old 02-28-2007, 06:36 AM   #4
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,126

Rep: Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120
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.
 
Old 02-28-2007, 06:39 AM   #5
sachin1361
Member
 
Registered: Feb 2007
Posts: 126

Original Poster
Rep: Reputation: 15
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

Last edited by sachin1361; 02-28-2007 at 06:40 AM.
 
Old 02-28-2007, 06:46 AM   #6
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,126

Rep: Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120
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
 
Old 02-28-2007, 07:03 AM   #7
sachin1361
Member
 
Registered: Feb 2007
Posts: 126

Original Poster
Rep: Reputation: 15
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
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Need Help Increasing Swap by creating a swap file froggo Red Hat 3 06-13-2006 08:04 AM
Why have a swap file when.... ? krkda Linux - General 8 04-15-2006 10:19 AM
swap file linuxhippy Linux - General 4 10-11-2004 04:07 PM
SWAP File TJ60515 Linux - Newbie 4 07-30-2003 03:37 PM
No Swap File tarballedtux Slackware 4 01-09-2003 02:07 PM

LinuxQuestions.org > Forums > Enterprise Linux Forums > Linux - Enterprise

All times are GMT -5. The time now is 01:35 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration