LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Hardware (https://www.linuxquestions.org/questions/linux-hardware-18/)
-   -   deleting/resizing swap partition / increasing hd space (https://www.linuxquestions.org/questions/linux-hardware-18/deleting-resizing-swap-partition-increasing-hd-space-264471/)

saranga2000 12-09-2004 09:51 AM

deleting/resizing swap partition / increasing hd space
 
Hi,

I recently installed redhat el 3 ( only decent CD based distribution I had around) on a Pentium 550 MHz, 326 MB RAM, 8 GB HDD box. It previously had Win2k, which I have chosen to keep, making my system a dual boot.
I have split the HDD into 3 GB for Win2k & 5 GB for Linux, the installation went smoothly, and I have been running both OS's smoothly for over 2 months now.

The problem I am facing is I am running out of space under linux. Fdisk gives:
fdisk hda
-----------------------------------------------------------
/dev/hda1 * 1 510 4096543+ 7 HPFS/NTFS
/dev/hda2 511 1245 5903887+ f Win95 Ext'd (LBA)
/dev/hda5 511 523 104391 83 Linux
/dev/hda6 524 794 2176776 83 Linux
/dev/hda7 795 925 1052226 83 Linux
/dev/hda8 926 1056 1052226 83 Linux
/dev/hda9 1057 1152 771088+ 82 Linux swap
/dev/hda10 1153 1217 522081 83 Linux
/dev/hda11 1218 1231 112423+ 83 Linux
/dev/hda12 1232 1245 112423+ 83 Linux



/etc/fstab:
----------------------------------------------------------------------------
LABEL=/ / ext3 defaults 1 1
LABEL=/boot /boot ext3 defaults 1 2
none /dev/pts devpts gid=5,mode=620 0 0
LABEL=/home /home ext3 defaults 1 2
LABEL=/opt /opt ext3 defaults 1 2
none /proc proc defaults 0 0
none /dev/shm tmpfs defaults 0 0
LABEL=/tmp /tmp ext3 defaults 1 2
LABEL=/usr /usr ext3 defaults 1 2
LABEL=/var /var ext3 defaults 1 2
/dev/hda9 swap swap defaults 0 0
/dev/cdrom /mnt/cdrom udf,iso9660 noauto,owner,kudzu,ro 0 0

df -kh
----------------------------------------------------------------------
Filesystem Size Used Avail Use% Mounted on
/dev/hda8 1012M 149M 812M 16% /
/dev/hda5 99M 9.0M 85M 10% /boot
/dev/hda7 1012M 767M 194M 80% /home
/dev/hda11 107M 7.3M 94M 8% /opt
none 157M 0 157M 0% /dev/shm
/dev/hda12 107M 50M 52M 49% /tmp
/dev/hda6 2.1G 1.8G 162M 92% /usr
/dev/hda10 494M 52M 417M 12% /var



I followed the thumb rule when creating the swap partition ( twice the RAM size). I also created the shm partition based on the redhat el3 installation guide. Since I am using this mainly as a desktop ( and I am guessing because of the slow speed of the CPU in conjuction with the pretty large RAM size) the RAM is never fully used up ( typically 75% use), the swap space is hardly used ( typically 10% use), and the shm is almost never used. This is even when I am running supposedly memory intensive processes ( like "make -j 8"). I have noticed it is the CPU that is in 100% use ( via gkrellm, everyone should have it on their linux box!) rather than memory.

I am also running very short on disk space, especially under /usr & /home. After that elaborate introduction, heres what this post is for:
I want to increase space by (deleting &/ resizing) /dev/shm & the swap partition. I have looked at other forums, and posting on this one on related topics. My present understanding is
a) It is risky - ( I have made a backup of the entire linux partition using mkCDRec ( everyone should try this app, it _seems_ superb). So not too much worry on that front)
b) The only way is to gain some hd space is to delete the swap partition, make a backup of all the data on the adjacent partition ( before or after, in my case hda8 or hda10), merge with the adjacent partition, reformat the new enlarged partition, migrate the data back. In my case hda8 & hda9 are neither /usr or /home so it still wont help.

Before I ramble on, can some Linux Guru help me do what I want to do, including answering:
0) The whole thing would be fixed if there was something like Partition magic for Linux, a non-destructive re/partitioning/re/sizing tool. Is that correct? Is there one?
1) Can it be done?
2) If yes, please explain in a step by step, explicitly explained manner.
3) What things do I need to be careful of?
4) How much space should I leave under swap & shm given I mostly use it as a desktop box, but plan to run some simple http server ( apache httpd) & maybe subversion server on it.


I did see some other ways I could increase disk space ( like deleting the files under /usr/local/locale? ) & I have done most of them. Any other suggestion would be most welcome.

Thanks in advance, someone do answer me.
Vinod

rjlee 12-09-2004 10:03 AM

0) http://www.gnu.org/software/parted/
1) Yes. Although I would be wary of resizing shmfs; it's not a physical disk partition which means that it's held in memory. Memory filesystems tend only to occupy RAM for the used portion of their space, so you may not save much there.
2) See http://www.gnu.org/software/parted/manual/
3) When you are messing with / or /boot, there is a good chance that you might delete your boot-loader. Keep a rescue disk to hand to make sure that you can reinstall it (find out how to do this first).
4) If you never use more than 10% of your swap space, then I'd cut it down to around 20% of its current size.


All times are GMT -5. The time now is 08:22 PM.