6 Replies Latest reply on Dec 24, 2011 8:15 AM by Araz

    resize SWAP

      i have configured my Oracle Enterprise LInux SWAP partion to 1.5 GB but oracle said me need 2.4 GB
      how to enlarge SWAP partition
        • 1. Re: resize SWAP
          [root@localhost ~]# /sbin/fdisk -l

          Disk /dev/sda: 80.0 GB, 80000000000 bytes
          255 heads, 63 sectors/track, 9726 cylinders
          Units = cylinders of 16065 * 512 = 8225280 bytes

          Device Boot Start End Blocks Id System
          /dev/sda1 * 1 9269 74453211 83 Linux
          /dev/sda2 9270 9530 2096482+ 83 Linux
          /dev/sda3 9531 9726 1574370 82 Linux swap / Solaris
          • 2. Re: resize SWAP
            That depends on where the swap is located. Is it on top of a logical volume, or a physical hard disk partition? What does "cat /proc/swaps" tell you? If it's on a logical volume, it should be fairly straightforward to increase the LV size. If it's a partition on disk, you have to either repartition and reinstall, or dynamically grow this partition, while shrinking another one (tools like Parted Magic can do this for you).
            • 3. Re: resize SWAP
              Hi Lenz,
              Thank you for your answer
              cat /proc/swaps gives me that:

              [root@localhost ~]# cat /proc/swaps
              Filename Type Size Used Priority
              /dev/sda3 partition 1574360 116 -1
              • 4. Re: resize SWAP
                Ah, I did not see this update while I wrote my reply. So you're using physical partitions - you need to use a partition resizing tool that can shrink /dev/sda2, to make room for /dev/sda3 - if you don't want to reinstall, consider using http://partedmagic.com/ for this. It's a free Linux-based rescue system that you can boot off a USB drive or CD-ROM.
                • 5. Re: resize SWAP
                  You can increase available swap space also by using a swap file as long as disk space permits. Today's storage systems are fast enough to make the speed advantages of a dedicated swap partition not very compelling considering the challenges of properly sizing a fixed swap partition and eventually wasting a lot of disk space. The advantage of a swap file is flexible space management because you can add or delete swap space on demand as necessary. The following will create and enable an addititional 1 GB swap file at system startup, located in the /home directory:

                  Login as root:
                  sudo su -
                  Enter the following commands:
                  dd if=/dev/zero of=/home/swapfile bs=1024 count=1048576
                  mkswap /home/swapfile
                  swapon /home/swapfile
                  swapon -a
                  Create a backup of the original "fstab" file and add the new swap file:
                  cp /etc/fstab /etc/fstab.backup_`date +%N`
                  echo '/home/swapfile swap swap defaults 0 0' >> /etc/fstab
                  Exit from root and verify the new swap space:
                  swapon -s
                  Filename                    Type          Size     Used     Priority
                  /dev/sda5                               partition     2095100     0     -1
                  /home/swapfile                          file          1048572     0     -2
                  Above is from Oracle 11gR2 Express Edition on Linux Ubuntu 11.10 how-to
                  Oracle 11gR2 Express Edition on Linux Ubuntu 11.10 howto

                  Edited by: Dude on Dec 23, 2011 3:44 AM
                  1 person found this helpful
                  • 6. Re: resize SWAP
                    very thanks for answer misters