[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: want to change /var/log partition to a directory in /var --help



Ionut Georgescu <george@pks.mpg.de> writes:

> Please send fdisk -l /dev/hda. Judging by your /etc/fstab, you can't do
> anything because you have /home and /tmp between /var and /var/log. The
> best you cand do is to move /tmp and /var/log to /var and extend /home
> :-)
> 
> I will describe the next steps anyway:
> 
> First: ext3 must resized offline. Second, if you modify the partition
> table while running you have to reboot anyway, because the kernel
> cannot reload the partition table while the disk is being used. You can
> combine these two into 2 steps:
> 
> cp -r /var/log /home/log.bak
> adjust partition table. delete the /var/log line in /etc/fstab
> 
> reboot into single user mode
> 
> What happens: after reboot, /dev/hda3 will be larger, but the filesystem
> has not changed yet. Being in single user mode, no program is running
> at all so you can just
> 	umount /var
> 	ext2resize /dev/hda3
> 	mount /var
> done
> 
> now you just need to copy log
> mount -o remount,rw /home
> rmdir /var/log
> mv /home/log.bak /var/log
> reboot

Alternatively, reinstall the whole system using Logical Volume
Management (LVM), and never fiddle around with partition resizing,
partition moving/copying, not even with partitions at all.  Never again
have to reboot for resizing your file systems, swap spaces or whatever
block devices.

Just call lvextend/lvreduce and resize2fs (or equivalent for your FS)
after umounting the affected file systems and your done.


urs



Reply to: