VMware Cloud Community
pwollenburg
Contributor
Contributor
Jump to solution

Resize SWAP Partition.

I want to resize my swap partition from 1.4gb to 7gb.

Some system data below:

Welcome to SUSE Linux Enterprise Server 11 SP3 for VMware  (x86_64) - Kernel \r (\l).

# uname -a

Linux Platinium2 3.0.76-0.11-default #1 SMP Fri Jun 14 08:21:43 UTC 2013 (ccab990) x86_64 x86_64 x86_64 GNU/Linux

# swapon -s

Filename                                Type            Size    Used    Priority

/dev/sda1                               partition       1532924 0       -1

# fdisk -l

Disk /dev/sda: 591.6 GB, 591631745024 bytes
255 heads, 63 sectors/track, 71928 cylinders, total 1155530752 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00033b0e

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1            2048     3067903     1532928   82  Linux swap / Solaris
/dev/sda2   *     3067904   471859199   234395648   83  Linux
/dev/sda3       471859200  1155530751   341835776   83  Linux

# cat /etc/fstab

/dev/sda1            swap                 swap       defaults              0 0

/dev/sda2            /                    ext3       acl,user_xattr        1 1

proc                 /proc                proc       defaults              0 0

sysfs                /sys                 sysfs      noauto                0 0

debugfs              /sys/kernel/debug    debugfs    noauto                0 0

devpts               /dev/pts             devpts     mode=0620,gid=5       0 0

/dev/sda3            /local/apps          ext3       noatime,acl,user_xattr 1 2

# free -k

             total       used       free     shared    buffers     cached

Mem:      16392148    1273944   15118204          0     149864     760472

-/+ buffers/cache:     363608   16028540

Swap:      1532924          0    1532924

Thanks,

Paul

0 Kudos
1 Solution

Accepted Solutions
DavoudTeimouri
Virtuoso
Virtuoso
Jump to solution

If you are using ESXi 5.x, please check out his: http://rickardnobel.se/esxi-5-0-partitions/

If you are using prior version of ESX, you can do it same as Linux systems.

-------------------------------------------------------------------------------------
Davoud Teimouri - https://www.teimouri.net - Twitter: @davoud_teimouri Facebook: https://www.facebook.com/teimouri.net/

View solution in original post

0 Kudos
4 Replies
DavoudTeimouri
Virtuoso
Virtuoso
Jump to solution

If you are using ESXi 5.x, please check out his: http://rickardnobel.se/esxi-5-0-partitions/

If you are using prior version of ESX, you can do it same as Linux systems.

-------------------------------------------------------------------------------------
Davoud Teimouri - https://www.teimouri.net - Twitter: @davoud_teimouri Facebook: https://www.facebook.com/teimouri.net/
0 Kudos
Borja_Mari
Virtuoso
Virtuoso
Jump to solution

Hello,

take a look to this, maybe it will be helpful:

http://www.novell.com/support/kb/doc.php?id=7003601

linux - How to increase swap size? - Server Fault

Best regards,

Pablo

------------------------------------------------------------------------------------------------- PLEASE CONSIDER AWARDING any HELPFUL or CORRECT reply. Thanks!! Por favor CONSIDERA PREMIAR cualquier respuesta ÚTIL o CORRECTA . ¡¡Muchas gracias!! VCP3, VCP4, VCP5-DCV (VCP550), vExpert 2010, 2014 BLOG: http://communities.vmware.com/blogs/VirtuallyAnITNoob
pwollenburg
Contributor
Contributor
Jump to solution

Thank you all for your help. Below is my current plan going forward, please let me know if this looks appropriate.

My current swap file is at:

/dev/sda1            swap                 swap       defaults              0 0

I want to make the sqpfile the same size of the memory which is 24gb.

1. Determine the size of the new swap file in megabytes and multiply by 1024 to determine the number of blocks.

    My current Memory 24gb = 24576 MB X 1024 = 25165824 blocks.

2. At a shell prompt as root, type the following command with count being equal to the desired block size:

    I want to place the new swap file on the partition /dev/sda2 and call the file swapfile

    I include the path to the swapfile, but do I have to create this file first?

   dd if=/dev/zero of=/dev/sda2/swapfile bs=1024 count=25165824

3. Setup the swap file with the command:  # mkswap /dev/sda2/swapfile

4. To enable the swap file immediately but not automatically at boot time:  # swapon /dev/sda2/swapfile

5. To enable it at boot time, edit /etc/fstab to include the following entry:

/dev/sda2/swapfile         swap            swap    defaults        0 0

6. For now I intend on leaving the original swap file alone. Do you think I should edit it out of the fstab?

Paul Wollenburg

0 Kudos
Borja_Mari
Virtuoso
Virtuoso
Jump to solution

Hello,

the steps are almost ok, but replace "/dev/sda2/swapfile" for "/swapfile".

Best regards,

Pablo

------------------------------------------------------------------------------------------------- PLEASE CONSIDER AWARDING any HELPFUL or CORRECT reply. Thanks!! Por favor CONSIDERA PREMIAR cualquier respuesta ÚTIL o CORRECTA . ¡¡Muchas gracias!! VCP3, VCP4, VCP5-DCV (VCP550), vExpert 2010, 2014 BLOG: http://communities.vmware.com/blogs/VirtuallyAnITNoob