You are not logged in.

#1 2008-02-24 10:05:55

ravisghosh
Member
From: Intergalactic Spaces
Registered: 2006-10-12
Posts: 516
Website

HOw to decreasing swap partition size-Solved

SAt the time of installing arch, I foolishly made my swap partition to be of 2 GB but now I realize that I do not need that much of space. How do I reduce that swap partition size to 750 mb and merge the rest of 1250 mb to another partition.

Here is the fdisk results:

 [shantanu@bluehead ~]$ fdisk -l

Disk /dev/sda: 40.0 GB, 40060403712 bytes
255 heads, 63 sectors/track, 4870 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x00006c9a

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1         637     5116671    b  W95 FAT32
/dev/sda2             638        4870    34001572+   f  W95 Ext'd (LBA)
/dev/sda5             638        1259     4996183+   c  W95 FAT32 (LBA)
/dev/sda6            1260        1521     2104483+  82  Linux swap / Solaris
/dev/sda7            1522        2311     6345643+  83  Linux
/dev/sda8            2312        4032    13823901   83  Linux
/dev/sda9            4033        4870     6731203+   b  W95 FAT32

My system is a 1 gb P3 with 256 mb ram.

Last edited by ravisghosh (2008-03-02 21:45:40)

Offline

#2 2008-02-24 14:19:27

noalwin
Member
From: Spain
Registered: 2007-06-08
Posts: 115

Re: HOw to decreasing swap partition size-Solved

I had used gparted for that thing this week. It's a graphical application that made easy work with partitions (I like to have a visual representation of the partitons). You also can use console apps like parted.

Last edited by noalwin (2008-02-24 14:20:31)

Offline

#3 2008-02-25 05:43:51

srimalik
Member
Registered: 2007-09-16
Posts: 65

Re: HOw to decreasing swap partition size-Solved

1. turn off swap
2. Delete the swap partition using fdisk
3. create a smaller partition and use it as swap.

Offline

#4 2008-02-25 10:35:10

ravisghosh
Member
From: Intergalactic Spaces
Registered: 2006-10-12
Posts: 516
Website

Re: HOw to decreasing swap partition size-Solved

noalwin wrote:

I had used gparted for that thing this week. It's a graphical application that made easy work with partitions (I like to have a visual representation of the partitons). You also can use console apps like parted.

Could you please describe the steps because if I make a mistake I will ruin my system.

Offline

#5 2008-03-01 10:41:53

noalwin
Member
From: Spain
Registered: 2007-06-08
Posts: 115

Re: HOw to decreasing swap partition size-Solved

ravisghosh wrote:
noalwin wrote:

I had used gparted for that thing this week. It's a graphical application that made easy work with partitions (I like to have a visual representation of the partitons). You also can use console apps like parted.

Could you please describe the steps because if I make a mistake I will ruin my system.

Opps,. I didn't saw the message, sorry for the delay.

On gparted, right click on your swap partition, then umount it, after that click resize and give it the size that you want. Then you will see free space. There create the new partition (ext3 filesystem is the more common choice). Then, apply the changes.

You probably will see 4 warnings in the proccess about that it can't check the swap partition, it's ok.

After that, review the /etc/fstab to see if you need to update the information stored there, and to add the new partiton and where you want to mount it. After that, reboot to see if all is ok. About the fstab, you maybe can take a look to http://wiki.archlinux.org/index.php/Per … ice_naming to refer to partitions using their labels instead the /dev/sda1 notation.


You can also use a live cd with gparted http://gparted-livecd.tuxfamily.org/ It's probably a safer way, but I did it without it.

Do backups (something always can go wrong) and don't modify mounted partitions. You can also resize another partition instead create a new one.

Last edited by noalwin (2008-03-01 10:56:54)

Offline

#6 2008-03-02 21:42:41

ravisghosh
Member
From: Intergalactic Spaces
Registered: 2006-10-12
Posts: 516
Website

Re: HOw to decreasing swap partition size-Solved

Thanks srimalik and noalwin,

got it done using gparted.

1. I first right clicked on swap partition adn then "swapoff" to turn swap off.
2. Clicked resize and reduced the size of swap to 500 mg leaving 1500 mg before swap so that I can merge it with sda5 which is a fat32 and is before swap partition.
3. then unmounted sda5 and resized it to include the free 1500 mb space.

Though I backed up my data in sda5, but after the resizing all the data was intact.

Offline

Board footer

Powered by FluxBB