[Ilugc] linux partition-reg

  • From: lug@xxxxxxxxxxxxxxxxxx (Chandrashekar B.)
  • Date: Fri Aug 27 21:05:57 2004

j. manikandan wrote:

Dear Friends,
 
During Partition of linux i given the var partition less in my server 
. It is possible to add more space to var partition from other 
partitions like home the home partition has additional space.
Please guide me to solve this issue.
regards
j.manikandan.
 
File system looks like this.
Filesystem           1K-blocks   Used     Available  Use% Mounted on
/dev/hda2              1510060    138700   1294652  10%   /
/dev/hda1               497829     13283    458844   3%     /boot
/dev/hda3              1004052    128952    824096  14%  /home
none                     62364         0           62364     0%   /dev/shm
/dev/hda7             10175300   4663232  4995180  49% /usr
/dev/hda6               497829    438191     33936     93%   /var 

If you had configured lvm while partitioning your hard disk,  the issue 
could've been sorted out in a simpler way.

Anyways, a crude way of solving this issue would be as below:
1. Run a 'du -sk /var/*' and make a note of directories which take up 
more space.

2. Make a recursive copy of those directories (use 'cp -a' to be safe) 
into a mouted partition with more space (for e.g. /usr).

3. Once you've confirmed that the files are safely copied (with 
attributes, permissions intact), delete the original directories (the 
ones in /var) that you copied. [You can directly use the 'mv' command 
and move those directories, but I would be a little hesitant to do such 
a thing on a live machine].

4. Create symbolic links from /var to the newly copied (or moved) 
directories ('ln -s').

[Boot from a linux rescue CD-ROM and mount these partitions in 
directories under /mnt or similar locations, to be more safe (to avoid 
problems with lock files). Change directory path indicated above 
appropriately.]

 From now on, files that get created in some directories of /var will be 
stored in /usr (or other partition where you linked the directories).

Cheers,
Chandrashekar Babu.

Other related posts: