Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I am receiving the error:

installing package kernel-2.6.36-2.x86_64 needs 52MB on the / filesystem

how can I safely expand the "/" partition?

Thanks

share|improve this question
2  
More information needed, please. What distribution? Are you using LVM? Do you have other storage available? What all is on / already? (Any other separate partitions?) –  mattdm Nov 17 '10 at 20:24
add comment

3 Answers

up vote 1 down vote accepted

If you're using LVM and you have available free space in your volume group:

# lvextend -L +500M /dev/vg0/root
# resize2fs /dev/vg0/root

(This assumes you're root filesystem is on a LV named root on a VG named vg0.)

If you're not using LVM, you'll need to use a partition editor like parted (http://www.gnu.org/software/parted/manual/parted.html) to resize partitions on your disk to create the necessary space. When you're finished, use resize2fs to grow the filesystem. Note that this process, if you're not careful, can result in data loss.

You could also remove some things from your root filesystem. If /var is on the same filesystem, there may be files in, e.g., /var/cache that can simply be removed (apt and yum, for example, both store packages in subdirectories of /var/cache before installing them).

share|improve this answer
add comment

Are you sure you can't clear up 52MB on the / partition? Perhaps removing old kernels ("rpm -qa | grep '^kernel'" for a list of them), perhaps there is space that can be cleared out of /var/tmp, /var/cache, or /tmp? Perhaps run "du -x / | sort -rn | less" will show you some files or directories that can be cleared out?

Perhaps there's something that you can archive to another system, install the kernel, remove the old kernel and then recover?

share|improve this answer
add comment

Without knowing what your current configuration is, it's impossible to give a sensible answer. Sean's answer is a good solution - assuming that you've got stuff on / you don't need. But if your whole disk really is full, then you've not got a lot of choices other than adding more storage.

In addition to knowing if you are using LVM, what partitions you've got set up currently and what the usage of these is, we'd need to know what filesystems you've got set up. It may be possible to boot up from a CD/USB and reorganise your partitions using gparted.

OTOH, it may be as simple as dropping down to single user mode and mapping in a spare partition, e.g.

mkfs -t ext4 /dev/sdb5
mkdir /newvar
mount /dev/sdb5 /newvar
mv /var/* /newvar/
umount /newvar
rmdir /newvar
echo '/dev/sdb5   /var  ext4  defaults  1 1' >>/etc/fstab
mount /var
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.