LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 06-23-2003, 11:57 PM   #1
dsuniln
LQ Newbie
 
Registered: Jun 2003
Location: India
Posts: 3

Rep: Reputation: 0
Creating a swap partition


i have installed red hat linux 9.0 without creating a swap partition. While installing it i did not get an option to create a swap partition.I have arround 1gb free space for the swap partition. Now i want to create a swap partition. How do i do it?
 
Old 06-24-2003, 01:01 AM   #2
adz
Senior Member
 
Registered: Jun 2003
Location: Sydney
Distribution: Debian, FreeBSD
Posts: 1,713

Rep: Reputation: 53
1 GB is a lot for swap. If you want, before you go too far, you can reduce this (you'll have to repartition the linux and the swap and hence you'll lose everything in the linux partition). Otherwise, run "fdisk /dev/hda" as root. Then have a look around: press "p" to print the table, "m" the print the available commands. When you're bored of this press "p" again to see where the free space is. Then press "n" to create a new partition. Select primary partition from the next prompt and tell it to use all the remaining space (unless you want to use some of that space for something else). When it asks you what kind of partition to make it, say swap (you'll have to choose the number corresponding to swap). Press "p" again and write down the name of the partition you just created (something like /dev/hda2).

Once all this is done, edit your /etc/fstab file. and add in the following line just after the first entry:

/dev/hda2 none swap sw

The spaces are arbitrary (one press of the spacebar will do). Reboot. Presto! you now have a swap partition.
 
Old 06-25-2003, 11:54 PM   #3
dsuniln
LQ Newbie
 
Registered: Jun 2003
Location: India
Posts: 3

Original Poster
Rep: Reputation: 0
i ran fdisk but it is not showing me free space when i print the partition information. I have a 40 gb hard disk which i have partitioned as c:,d: for windows and /*,/*boot for linux Now i have 1 gb free space which i want to use as a swap partition. Even when i installed linux and used disk druid to create the partitions, it did not allow me to create a swap partition saying that there was insufficient space....
 
Old 06-26-2003, 01:29 AM   #4
xiaodown
Member
 
Registered: Jun 2003
Location: Virginia
Distribution: Redhat, Centos, Fedora
Posts: 37

Rep: Reputation: 15
If you could, become root and type:
fdisk -l
and
df -k

and post the outputs here.
 
Old 06-27-2003, 01:06 AM   #5
dsuniln
LQ Newbie
 
Registered: Jun 2003
Location: India
Posts: 3

Original Poster
Rep: Reputation: 0
when i run fdisk -l i get the following output

Device boot start end blocks id system
/dev/hda1 * 1 1913 15366141 7 HPFS/NTFS
/dev/hda2 1914 3591 13478535 f Win 95 Ext'd (LBA)
/dev/hda3 3592 3604 104422+ 83 Linux
/dev/hda4 3605 4726 9012465 83 Linux
/dev/hda5 1914 3591 13478503+ 7 HPFS/NTFS

when i run df -k i get the following output

file system 1k-blocks used available use% Mounted on
/dev/hda4 8870804 5003840 3416344 60% /
/dev/hda3 10107 9324 816562 10% /boot
none 111472 0 111472 0% /dev/shm
 
Old 06-27-2003, 04:56 AM   #6
michaelk
Moderator
 
Registered: Aug 2002
Posts: 15,716

Rep: Reputation: 1750Reputation: 1750Reputation: 1750Reputation: 1750Reputation: 1750Reputation: 1750Reputation: 1750Reputation: 1750Reputation: 1750Reputation: 1750Reputation: 1750
How many total sectors does fdisk says the disk has?

You might have free space on the end of your drive but your problem is that you can not create a partition for swap because:

1. You already have 4 parimary partitions and can not create another one.

2. hda5 is using up all of the space in your extended partition hda2 and therefore can not create another logical partition.

You will need to resize hda2 but to do this hda3 and hda4 need to be moved to the end of the drive. parted may or may not work depending on what kind of filesystem systems they are. See parted documentation for limitations.

Partition Magic will probably work.

Do you need a swap partition? How much RAM do you have? Like the previous post says 1gb is a lot of swap for an ordinary user unless you have RAM intensive apps or running a high volume server of some type. Most people can get by with 512mb.

You can create a swap file on your root partition. It will not be as fast as a partition.
 
Old 06-27-2003, 11:17 PM   #7
adz
Senior Member
 
Registered: Jun 2003
Location: Sydney
Distribution: Debian, FreeBSD
Posts: 1,713

Rep: Reputation: 53
Yes that's correct. Only 4 primary partitions are allowed per disk. What you should do is create 3 primary partitions:
Linux
Linux Swap
NTFS/HPFS (Windows)

Then LOGICALLY partition Linux into / and /boot and then LOGICALLY partition Windows into C: and D:. This should solve your problem. You can use the programs suggested by michaelk or you'll have to reinstall everything.
 
Old 06-27-2003, 11:21 PM   #8
adz
Senior Member
 
Registered: Jun 2003
Location: Sydney
Distribution: Debian, FreeBSD
Posts: 1,713

Rep: Reputation: 53
One more thing... I have 256Mb of RAM. My swap is the same size. I almost never hear my computer swapping and whenever I checked my swap partition, it was unused. Mind you, I use Debian which runs a little lighter than Red Hat but it shows you that you don't need ANYWHERE NEAR the amount of swap sapce under linux as you do under windows.
 
Old 06-28-2003, 12:33 AM   #9
xiaodown
Member
 
Registered: Jun 2003
Location: Virginia
Distribution: Redhat, Centos, Fedora
Posts: 37

Rep: Reputation: 15
It's a good practice to maintain your swap file, though. I mean, it has to be there. But, like, if you don't think you need it, you don't have to make it as big as the ram. Some people make it twice as big as the ram.

If, in future situations, you want to maKe your swap smaller, you can probably do that.

~Wx
 
Old 06-30-2003, 12:18 PM   #10
cpierce69
LQ Newbie
 
Registered: Jun 2003
Location: Texas
Distribution: RH9
Posts: 1

Rep: Reputation: 0
same problem

Quote:
Originally posted by dsuniln
i ran fdisk but it is not showing me free space when i print the partition information. I have a 40 gb hard disk which i have partitioned as c:,d: for windows and /*,/*boot for linux Now i have 1 gb free space which i want to use as a swap partition. Even when i installed linux and used disk druid to create the partitions, it did not allow me to create a swap partition saying that there was insufficient space....
Just to let you know, I ran into the same problem. I have actually found a few others that did the same thing. It sounds like we might have hit a limit of some sort when trying to create a "5th" partition. I have winme, and older system, that I wanted to install RH9 on. I created root and boot, then tried to create swap, but disk druid would not go it. The auto completly failed, but disk druid allowed me to create / & /boot
My system works just fine, but after bootup, I only have about 70MB free (out of 256MB) from free command. It shows 0 0 0 for swap, and I am here to look for suggestions. I just came from www.justlinux.com and kinda got flammed for asking a question before looking it up. There is so much out there it just gets overwhelming, and I did not want to have to install everything from scratch again. Its funny, with just a few posts from you guys, it sounds like the answer is there. I had to go to politics of newbie this and newbie that and I still was confused. Thanks for taking the time to answer questions without all the BS.
<- begins to suck after a few days of getting no where!
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Creating a swap partition on an old pc, WITHOUT using linux... TheMusicGuy Linux - General 17 08-09-2004 12:43 AM
problem creating swap partition during installation kristof Red Hat 11 07-03-2004 01:25 PM
creating swap lynos Linux - General 6 03-27-2004 07:07 AM
Creating a swap partition thejackal13 Linux - Newbie 6 10-30-2003 07:03 PM
Newbie Installing Debian3 on m68k w/250M Partition Needs help creating swap partition AppleMac Linux - Newbie 2 11-01-2002 08:45 AM


All times are GMT -5. The time now is 12:50 PM.

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration