Find the answer to your Linux question:
Results 1 to 9 of 9
Greetings everyone! I am using RedHat Enterprise Linux 5.1 along with WindowsXP my fdisk - l looks like this: Disk /dev/hdc: 160.0 GB, 160041885696 bytes 255 heads, 63 sectors/track, 19457 ...
  1. #1
    Just Joined!
    Join Date
    Jun 2010
    Posts
    2

    Exclamation Swap Problem

    Greetings everyone!

    I am using RedHat Enterprise Linux 5.1 along with WindowsXP

    my fdisk - l looks like this:

    Disk /dev/hdc: 160.0 GB, 160041885696 bytes
    255 heads, 63 sectors/track, 19457 cylinders
    Units = cylinders of 16065 * 512 = 8225280 bytes

    Device Boot Start End Blocks Id System
    /dev/hdc1 * 1 4708 37816978+ 7 HPFS/NTFS
    /dev/hdc2 4709 17760 104840190 f W95 Ext'd (LBA)
    /dev/hdc3 17761 17773 104422+ 83 Linux
    /dev/hdc4 17774 19048 10241437+ 83 Linux
    /dev/hdc5 4709 9155 35720496 7 HPFS/NTFS
    /dev/hdc6 9156 13667 36242608+ 7 HPFS/NTFS
    /dev/hdc7 13668 17760 32876991 7 HPFS/NTFS

    The problem:
    I need to setup swap partition, i have already gone through the following link for help:
    www[DOT]redhat[DOT]com/docs/manuals/linux/RHL-8.0-Manual/custom-guide/s1-swap-adding[DOT]html

    They say that we have to use this command to create swap partiton:
    mkpartfs part-type linux-swap start end
    where part-type is one of primary, extended, or logical, start is the starting point of the partition, and end is the end point of the partition.

    The problem is: How do I determine the start and end point for the swap partiton?

    when I use the print command from parted tool, i get this:

    Number Start End Size Type File System Flags
    1 32.3KB 38.7GB 38.7GB Primary ntfs boot
    2 38.7GB 146GB 107GB Extended lba
    5 38.7GB 75.3GB 36.6GB Logical ntfs
    6 75.3GB 112GB 37.1GB Logical ntfs
    7 112GB 146GB 33.7GB Logical ntfs
    3 146GB 146GB 107MB Primary ext3
    4 146GB 157GB 10.5GB Primary ext3

    Now, i know that i still have about 3GB of unused space (raw space) on my hardrive.
    I want to use this space for my swap partition, but where do i find it? and how do I use it for my swap partition?

    Thanks

  2. #2
    Linux Guru Rubberman's Avatar
    Join Date
    Apr 2009
    Location
    I can be found either 40 miles west of Chicago, or in a galaxy far, far away.
    Posts
    8,974
    You'll note that fdisk -l showed that there are 19457 cylinders, but the last partition (/dev/hdc4) ends on 19048. That means that if you had some more partition entries (you don't) you could create one on cylinders 19049-19457. Basically, your partition table is your limiting factor. You are limited to 4 primary partitions, one of which can be an extended one with more sub-partitions. However, since the Extended LBA partition (/dev/hdc2) is not the last partition, you have locked yourself out of that extra space at the end of the drive. You might be able to use a tool such as gparted to fix that, but I'm thinking you will need to backup everything and repartition your drive to get that space for swap. That said, I'm sure that if some other lurker on the forums knows another solution that they will pipe up and set us straight!
    Sometimes, real fast is almost as good as real time.
    Just remember, Semper Gumbi - always be flexible!

  3. #3
    Just Joined!
    Join Date
    Jun 2010
    Posts
    2
    Hey thank you so much Rubberman...

    I was thinking...If I could make a new partition of the free space (in windows)...then may be I could use it here as a swap partition..

    wht do u think...will it work?

  4. #4
    Just Joined!
    Join Date
    May 2007
    Posts
    72
    Quote Originally Posted by ashu001 View Post
    Hey thank you so much Rubberman...

    I was thinking...If I could make a new partition of the free space (in windows)...then may be I could use it here as a swap partition..

    wht do u think...will it work?
    As Rubberman has said, you are limited to four "primary" partitions, of which one only can be an "extended" partition. This extended partition can be thought of as a box which holds a number of "logical" partitions. (These limits are due to the PC spec, not to Linux or Windows) So if I've read your idea correctly, you would be trying to have five primary partitions, which will not work. You could either:
    1) Delete your Linux partitions hdc3 and hdc4, and extend the extended partition hdc2 to the end of the disc, and then use the unused space within hdc2 to make a swap partition and one or two Linux partitions. These would be logical partitions.
    2) Delete the logical partitions 5,6, and 7 within hdc2 as well, extend partition 2 to the end of the disc as before , and repartition it . If you have data that you want to access from both Linux and Windows you might be best to put this in a FAT32 partition.
    Needless to say, you will lose everything in partitions that you modify, so back up everything ffirst.
    Incidentally, 3G of swap sounds like rather a lot to me.

  5. #5
    Linux Guru Rubberman's Avatar
    Join Date
    Apr 2009
    Location
    I can be found either 40 miles west of Chicago, or in a galaxy far, far away.
    Posts
    8,974
    I agree with everything impert says, with the exception of that last "3G of swap sounds like rather a lot to me". Generally, you want swap space either 1x or 2x the RAM size, but it can be more if you are running a memory-constrained system and occasionally need to run some big applications. In any case, hitting swap has a very bad effect on system performance. So, 3GB for 3-4GB of physical RAM would be about right.
    Sometimes, real fast is almost as good as real time.
    Just remember, Semper Gumbi - always be flexible!

  6. #6
    Just Joined!
    Join Date
    May 2007
    Posts
    72
    Hi Rubberman,
    I had the impression that with large amounts of RAM swap space becomes less necessary. I have 6G RAM and I don't think I've ever seen swap being used, even doing benchmarks. On the other hand I suppose you could say that newish systems with large RAM usually have large HD's, so you might as well have heaps of swap. In short, I don't know what's reasonable, and I suspect that lots of others don't either.
    I would be very interested to see a rule for calculating swap size, based on reasonable assumptions, that was valid all the way from, say, 128M of RAM to whatever is really huge at the moment.

  7. #7
    Just Joined!
    Join Date
    May 2007
    Posts
    72
    A further thought. Consider two machines, identical except that one has 1G RAM and 2G swap, while the other has 3G RAM and no swap. What happens when they run out of virtual memory performing the same task? Will the box with 3G RAM be any worse off than the other?

  8. #8
    Linux Guru Rubberman's Avatar
    Join Date
    Apr 2009
    Location
    I can be found either 40 miles west of Chicago, or in a galaxy far, far away.
    Posts
    8,974
    Quote Originally Posted by impert View Post
    A further thought. Consider two machines, identical except that one has 1G RAM and 2G swap, while the other has 3G RAM and no swap. What happens when they run out of virtual memory performing the same task? Will the box with 3G RAM be any worse off than the other?
    They'll both run out of memory at the same point (more or less), but the one with 3GB of physical RAM will run at normal speed up to the end. Please note, I run multiple VM's on my system at the same time. One is Windows XP w/ 2GB or ram, and another is Solaris x86 w/ 1GB of RAM. I am running a CentOS 5.5 workstation w/ 8GB RAM and 16GB of swap. If I am running a couple of VM's, an Oracle 11 database, KDE, compiling a large application or kernel, Open Office applications, and other stuff, then I can easily hit "the wall" with RAM and even in such a case, having adequate swap for those rare occasions when I actually need more than 8GB of RAM (I also have 2 quad-core Xeon processors) is mandatory. In any case, you have to determine what your needs are, and configure your system accordingly. In my opinion, too much swap space only takes up disc space, but too little can cause real problems.
    Sometimes, real fast is almost as good as real time.
    Just remember, Semper Gumbi - always be flexible!

  9. #9
    Just Joined!
    Join Date
    May 2007
    Posts
    72
    In my opinion, too much swap space only takes up disc space, but too little can cause real problems
    .
    Fair enough. Thanks for replying.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...