Cobbler 导入失败

Cobbler 导入失败

我最近一直在使用 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)

rsync: 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

答案1

回答我自己的问题

我的文件系统是 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 会在根分区上写入,该分区有足够的空间来支持它,并且一切正常。

答案2

不完整的 iso 映像下载也是此类错误的原因。请确保对 iso 映像进行校验和检查

相关内容