LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (http://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Increase disk space without erasing data (http://www.linuxquestions.org/questions/linux-newbie-8/increase-disk-space-without-erasing-data-506444/)

stranger_6_7 12-01-2006 01:33 AM

Increase disk space without erasing data
 
Hi,

I have installed lamp on my rhel4 machine.During installation of mysql
the default directory that was selected is /var. Now after when i set up my database with all tables, there is no space left in /var and
mysql is crashing every time as the /var has little free space.

Allocated Used Available Use%
/dev/hda8 381138 354023 7437 98% /var


How can i increase the disk space by adding free space from other drives without erasing /var as it consists of several system files.


Thanks for the Help
Stranger

nadroj 12-01-2006 01:38 AM

the only program i know of to resize a partition without loosing data is PartitionMagic. its a commercial program and cost a bit of cash.

edit: if the partition is resierfs, it looks like you may be in luck: http://qtparted.sourceforge.net/features.en.html

michaelk 12-01-2006 07:04 AM

qtparted or parted can resize partitions. Post the output of the command
fdisk -l (must be root, that is a small L)

matthewg42 12-01-2006 07:26 AM

A word to the wise: backup before resizing!

farslayer 12-01-2006 11:17 AM

I'll second matthew on this one..
Even though those applications are supposed to be able to resize partitions on the fly there is always a chance it will just not work and the data will be lost..

Alternately since your issue is simply one of space on var due to a database issue.. if You have unpartitioned space on the drive you could always add a new partition and ultimately mount it as /var/lib/mysql and move your mysql data to the new partition.. Nothing says you actually HAVE to resize the entire var partition. there are other solutions that will accomplish your main goal and may be an easier solution in the long run. This is one of the reasons I love the way Linux handles partitions and mount points.. so much better than Drive letters :)


example moving /var/lib/mysql to a new drive entirely..
Code:

default@IBM-300GL-1:~$  mount
/dev/hda1 on / type ext3 (rw,errors=remount-ro)
/dev/hda3 on /home type ext3 (rw)
/dev/hdb1/ on /var/lib/mysql type ext3 (rw)

IBM has a nice moving data and partitions on their site for Unix.. it's pretty similar.
http://www-128.ibm.com/developerwork...UnixFileSystem

pixellany 12-01-2006 12:48 PM

This looks like a good reason to NOT have a lot of different partitions. As a relative newcomer, I have always been puzzled at the rationale for having more than maybe 3 partitions (/, /boot, and /home) + swap.
It seems that you have to be pretty experienced to know which partitions will need how much space.....

farslayer 12-01-2006 02:32 PM

Quote:

Originally Posted by pixellany
This looks like a good reason to NOT have a lot of different partitions. As a relative newcomer, I have always been puzzled at the rationale for having more than maybe 3 partitions (/, /boot, and /home) + swap.
It seems that you have to be pretty experienced to know which partitions will need how much space.....


Agreed.. I think that was the most confusing part of the initial Linux setup..
what partitions do I need and how much space for each..
And who knew that Apache and Mysql both store their data under var ?
I would have never guessed that starting out.

after you get a grip though and discover you can expand any directory by mounting a new partition to that point, makes it easy to relocate Home, usr or var when they get out of control..

Now that I think back I wonder how long it actually was between the time I was doing my initial installs and was totally confused on partitioning and when I discovered how to manage multiple mount points and partitions.. hrm.

good point.

eerok 12-01-2006 03:05 PM

Strictly speaking, you don't need to repartition to solve this problem. If you have room on your root partition, you can make a few dirs on, say, /usr/local, copy those dirs over, and link to them from /var ...

Ideal? No. Sloppy? Probably. But it should work.

I've always linked htdocs out of /var to share it between distros, which is a similar thing.

syg00 12-01-2006 04:21 PM

Quote:

Originally Posted by pixellany
This looks like a good reason to NOT have a lot of different partitions.

Maybe, maybe not.
Quote:

As a relative newcomer, I have always been puzzled at the rationale for having more than maybe 3 partitions (/, /boot, and /home) + swap.
It seems that you have to be pretty experienced to know which partitions will need how much space.....
Excellent argument for LVM - and not completely allocating the entire disk(s). I'd be surprised if el4 doesn't use LVM by default.


All times are GMT -5. The time now is 07:20 PM.