Rsync

補鞋匠導入失敗

  • April 25, 2016

我最近一直在玩 Cobbler(在 CentOS 7 發行版上),我在導入 CentOS 7 iso 時遇到了錯誤。我已經能夠找到解決該問題的方法,並且我認為分享我學到的東西會很酷。

這是有問題的問題:

$ sudo mount -t iso9660 -o loop,ro CentOS-7-x86_64-DVD-1503-01.iso /mnt
$ sudo cobbler import --name=centos7 --arch=x86_64 --path=/mnt
task started: 2015-05-29_144409_import
task started (id=Media import, time=Fri May 29 14:44:09 2015)
Exception occured: <class 'cobbler.cexceptions.CX'>
Exception value: 'Command failed'
Exception Info:
 File "/usr/lib/python2.7/site-packages/cobbler/remote.py", line 87, in run
   rc = self._run(self)
  File "/usr/lib/python2.7/site-packages/cobbler/remote.py", line 231, in runner
   self.logger
  File "/usr/lib/python2.7/site-packages/cobbler/api.py", line 892, in import_tree
   utils.run_this(rsync_cmd, (spacer, mirror_url, path), self.logger)
  File "/usr/lib/python2.7/site-packages/cobbler/utils.py", line 917, in run_this
   die(logger,"Command failed")
  File "/usr/lib/python2.7/site-packages/cobbler/utils.py", line 134, in die
   raise CX(msg)

!!! TASK FAILED !!!

這是相應的 /var/log/cobbler/cobbler.log 摘錄

Fri May 29 14:44:09 2015 - DEBUG | REMOTE expiring token; user(<DIRECT>)
Fri May 29 14:44:09 2015 - DEBUG | REMOTE expiring token; user(<DIRECT>)
Fri May 29 14:44:09 2015 - DEBUG | REMOTE expiring token; user(<DIRECT>)
Fri May 29 14:44:09 2015 - DEBUG | REMOTE CLI Authorized; user(?)
Fri May 29 14:44:09 2015 - INFO | REMOTE start_task(Media import); event_id(2015-05-29_144409_import); user(?)
Fri May 29 14:44:10 2015 - INFO | import_tree; ['/mnt', 'centos7', None, None, None]
Fri May 29 14:44:10 2015 - INFO | importing from a network location, running rsync to fetch the files first
Fri May 29 14:44:10 2015 - INFO | running: rsync -a  '/mnt/' /var/www/cobbler/ks_mirror/centos7-x86_64 --progress
Fri May 29 14:44:10 2015 - INFO | received on stdout: sending incremental file list
images/pxeboot/
images/pxeboot/initrd.img
      32768   0%    0.00kB/s    0:00:00
Fri May 29 14:44:10 2015 - DEBUG | received on stderr:
rsync: writefd_unbuffered failed to write 4 bytes to socket [sender]: Broken pipe (32)
rsync: write failed on "/var/www/cobbler/ks_mirror/centos7-x86_64/images/pxeboot/initrd.img": No space left on device (28)
rsync error: error in file IO (code 11) at receiver.c(322) [receiver=3.0.9]
rsync: connection unexpectedly closed (40 bytes received so far) [sender]
rsync error: error in rsync protocol data stream (code 12) at io.c(605) [sender=3.0.9]

Fri May 29 14:44:10 2015 - INFO | Exception occured: <class 'cobbler.cexceptions.CX'>
Fri May 29 14:44:10 2015 - INFO | Exception value: 'Command failed'
Fri May 29 14:44:10 2015 - INFO | Exception Info:
 File "/usr/lib/python2.7/site-packages/cobbler/utils.py", line 126, in die
   raise CX(msg)

Linersync: write failed on "/var/www/cobbler/ks_mirror/centos7-x86_64/images/pxeboot/initrd.img": No space left on device (28)說 /var 上沒有更多空間了。我認為 Cobbler 創建的文件對於我只有 4GB 的分區initrd.img來說太大了。/var

回答我自己的問題

我的文件系統是 XFS,位於 LVM 分區之上。最好的解決方案是調整 /var 分區的大小,使其有足夠的空間來支持 rsync 操作。問題是當我在這台機器上安裝 CentOS 7 時,我已經分配了所有可用的磁碟空間,所以沒有可用空間來擴大 /var。

所以我決定將 /var/www/cobbler 移到根分區上,將其移至 /usr

$ sudo mkdir -p /usr/var/www
$ sudo mv /var/www/cobbler /usr/var/www/

然後,我創建了一個符號連結:

$ cd /var/www
$ sudo ln -sd /usr/var/www/cobbler

現在,在執行時cobbler import,rsync 在根分區上寫入,該分區有足夠的空間來支持它,並且一切正常。

引用自:https://serverfault.com/questions/695248