jenkins-No space left on device

背景

今天编译Jenkins出现maven编译成功,但是输出包失败,详情如下:

Caused by:java.io.IOException: No space left on device
    at java.io.FileOutputStream.writeBytes(Native Method)
    at java.io.FileOutputStream.write(FileOutputStream.java:345)
    at org.apache.commons.io.IOUtils.copyLarge(IOUtils.java:1793)
    at org.apache.commons.io.IOUtils.copyLarge(IOUtils.java:1769)
    at org.apache.commons.io.IOUtils.copy(IOUtils.java:1744)
    at hudson.util.IOUtils.copy(IOTuils.java:40)
    at hudson.FilePath.readFromTar(FilePath.java:2318)
....13 more

Cause by:java.util.concurrent.ExecutionException:java.io.IOException:This archives contains unclosed entries.
...12 more

Cause by:java.io.IOException:This archives contains unclosed entries.
...

问题排查

  1. du -sh查询服务器磁盘占用情况,确实发现jenkins目录磁盘占用100%
[root@jenkins-1 workspace]# df -h
Filesystem               Size  Used Avail Use% Mounted on
/dev/mapper/centos-root   49G   49G  325M 100% /
devtmpfs                 1.9G     0  1.9G   0% /dev
tmpfs                    1.9G     0  1.9G   0% /dev/shm
tmpfs                    1.9G   33M  1.9G   2% /run
tmpfs                    1.9G     0  1.9G   0% /sys/fs/cgroup
/dev/sda1               1014M  180M  835M  18% /boot
tmpfs                    380M     0  380M   0% /run/user/0
  1. /var/lib/jenkins/jobs使用du -h -x --max-depth=1查看所有jenkins job磁盘占用情况
[root@jenkins-1 jobs]# du -h -x --max-depth=1
30G     ./workspace_1
13G     ./workspace_2
42G     .

解决

  1. 清除当前工作空间
  2. 删除war包
    find jobs/ -name "" |grep -v config.xml |grep -v lastStableBuild|grep -v lastUnsuccessfulBuild|grep -v lastSuccessfulBuild|grep ".war$"|xargs rm -rf
    
  3. 删除jar包
    find jobs/ -name "" |grep -v config.xml |grep -v lastStableBuild|grep -v lastUnsuccessfulBuild|grep -v lastSuccessfulBuild|grep ".jar$"|xargs rm -rf
    
  4. 修改jenkins web页面build配置:General->丢弃旧的构建

你可能感兴趣的:(software,异常)