Operating System - Linux
1835421 Members
2710 Online
110078 Solutions
New Discussion

add space to a file system

 
tuhin
Occasional Advisor

add space to a file system

my /var system is full.
so i need to add a new hdd.
but how can i add or grow my /var system to this new space.
2 REPLIES 2
I_M
Honored Contributor

Re: add space to a file system

Hi

1) buy a disk
2) connect the disk
if you buy a scsi disk, it would be /dev/sdX.
if you buy a IDE disk, it would be /dev/hdX.

3) Create a partition by fdisk.
You need to use "n" for create new partition, "p" for preview and "w" for write quit in the fdisk.

4) After create the partition, create filesystem.

(ext2)
mkfs -t ext2 /dev/your-device-file

(ext3)
mkfs -j /dev/your-device-file

5) test for mount the new partitin.
# mkdir /test
# mount /dev/your-device-file /test
# df
# umount /test

6) boot the system single user mode

From lilo prompt,
boot: linux single

7) mount the new partition
# mkdir /2ndvar
# mount /dev/your-device-file /2ndvar
# df

8) mount the your original /var

9) copy the data
# cd /var
# find . -print | cpio -pvmdu /2ndvar

10) compare the size
# df

11) Change /etc/fstab to use new var at next boot

12) reboot (with your finger cross)

13) boot and check

My recommendation is, cleanup your /var dir , if you feel this procedure is too complicated....

Good luck
Bill Thorsteinson
Honored Contributor

Re: add space to a file system

Are you rotating your log files. Implement logrotate,
and clear out old logs. This
should help.

Walk your /var tree using
du -s *
to find the largest space users. Likely /var/adm.