yum遇到空间不足时解决方案

执行yum update时提示空间不足,目前见到了2种:
1.我升级过程中遇到的问题,提示如下:
Transaction Check Error:
  installing package kernel-PAE-2.6.34.7-61.fc13.i686 needs 6MB on the /boot filesystem

Error Summary
-------------
Disk Requirements:
  At least 6MB more space needed on the /boot filesystem.

出现此问题后用df查看分区情况,结果如下:
[bochs@localhost ~]$ df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/sda2             3.9G  3.2G  466M  88% /
tmpfs                 502M   24K  502M   1% /dev/shm
/dev/sda1              49M   26M   21M  55% /boot
/dev/sda5              14G  1.1G   13G   8% /home 

解决方法:
(1)Remove old kernels. If you have multiple old kernels you're no longer using, you might be able to free up enough space to install the new one by uninstalling the very oldest kernel image. This will only work if you have 2 or more kernels installed, and assumes your system isn't actually using that oldest kernel image.

实例(http://www.itenter.com/operatingsystems/linux/2010/0811/5516.html):
[nsdy@localhost ~]$ uname -r    查看现在所使用的kernel
2.6.33.6-147.2.4.fc13.i686.PAE
[nsdy@localhost ~]$ rpm -qa | grep kernel   检查系统中所存在的kernel
kernel-headers-2.6.33.6-147.2.4.fc13.i686
kernel-PAE-devel-2.6.33.6-147.2.4.fc13.i686
abrt-addon-kerneloops-1.1.1-2.fc13.i686
kernel-PAE-2.6.33.6-147.2.4.fc13.i686
kernel-2.6.33.6-147.2.4.fc13.i686
kernel-PAE-devel-2.6.33.6-147.fc13.i686
kernel-PAE-2.6.33.6-147.fc13.i686
kernel-2.6.33.6-147.fc13.i686
系统中有两个版本的内核,分别是2.6.33.6-147和2.6.33.6-147.2.4。根据uname查询结果可知现在147.2.4内核下,而且这个内核已经是新内核,所以我们删除旧内核2.6.33.6-147。
[nsdy@localhost ~]$ su -c’yum remove kernel-2.6.33.6-147.fc13.i686 kernel-PAE-2.6.33.6-147.fc13.i686 kernel-PAE-devel-2.6.33.6-147.fc13.i686′
[nsdy@localhost ~]$ reboot   重启系统并检查现在内核

实战:
[bochs@localhost ~]$ df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/sda2             3.9G  3.2G  466M  88% /
tmpfs                 502M   24K  502M   1% /dev/shm
/dev/sda1              49M   26M   21M  55% /boot
/dev/sda5              14G  1.1G   13G   8% /home
[bochs@localhost ~]$ uname -r
2.6.33.3-85.fc13.i686.PAE
[bochs@localhost ~]$ rpm -qa | grep kernel
abrt-addon-kerneloops-1.1.0-1.fc13.i686
kernel-PAE-devel-2.6.33.3-85.fc13.i686
kernel-headers-2.6.33.3-85.fc13.i686
kernel-PAE-2.6.33.3-85.fc13.i686
没有多个内核,所以没法用删除内核的方法了。不过可以试试删除一个package看看效果。
[root@localhost bochs]# yum remove kernel-PAE-2.6.33.3-85.fc13.i686
[root@localhost bochs]# rpm -qa | grep kernel
abrt-addon-kerneloops-1.1.0-1.fc13.i686
kernel-PAE-devel-2.6.33.3-85.fc13.i686
kernel-headers-2.6.33.3-85.fc13.i686
[root@localhost bochs]# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/sda2             3.9G  3.1G  590M  85% /
tmpfs                 502M   24K  502M   1% /dev/shm
/dev/sda1              49M  5.4M   41M  12% /boot   //可用空间增大了
/dev/sda5              14G  1.1G   13G   8% /home

 

(2)Relocate /boot to the root partition. You could relocate /boot from its own partition to a directory on the root partition (/). I'm not sure of the process -- I'd assume this would get the basic setup going, but you'd need another command to update your bootloader (Grub?) and alert it to the new location.
These commands need root privs (use sudo with each, or get a root shell with su).

make the new location
mkdir /boot-new

copy boot files
( cd /boot ; tar cf - . ) | ( cd /boot-new ; tar xvf - )
(with sudo...)
sudo sh -c "( cd /boot ; tar cf - . ) | ( cd /boot-new ; tar xvf - )"

unmount separate partition -- maybe not doable without rebooting? maybe need to boot to a liveCD?
umount /boot

remove old boot directory, rename new
mv /boot /boot-old
mv /boot-new /boot

edit /etc/fstab, comment out /boot partition line or change mountpoint to /boot-old

missing step: reconfigure your bootloader to access /boot on /dev/sda7 instead of the old version on /dev/sda6.


(3)Resize your /boot partition. You'll need a LiveCD for the task. Boot into it and run gparted. You'll probably need to resize your system partition slightly, then move it, to make room. I can't give you specifics without knowing the partition table.

Expand the /boot partition to a size of at least 2-300MB to avoid having this problem again.

Resizing system partitions can be dangerous. Make backups before you attempt it, and read up on what you are doing before you do it. This is my least recommended option.


(4)Replace your system drive. Finally, if you've wanted a larger system hard drive, now is a great time to do so. In the process of copying partitions from the old drive to the new, you can expand the /boot partition. You'd use a LiveCD for this as well.
原文见:http://superuser.com/questions/82204/resizing-the-boot-partition

 

2.网上看到的问题,提示如下:
Insufficient space in download directory //var/cache/yum/updates/packages
解决方法:
(1)
For example if mounted partition /u has sufficient room,
cd /var/cache
find yum -print|cpio -pdmv /u
rm -rf yum
ln -s /u/yum yum

或者

yum clean all  清空一下缓存
(2)
yum update 的软件包,可以放在别的地方。即可。
修改/etc/yum.conf 里面第一个就是下载包放的位置。我放在/home/XX/fc10 里面。用户备份。
[~ $] more /etc/yum.conf 
1 [main]
2 #cachedir=/var/cache/yum
3 cachedir=/home/XX/fc10-yum

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值