linux – 使用tar备份整个centos时出错

前端之家收集整理的这篇文章主要介绍了linux – 使用tar备份整个centos时出错前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我正在尝试这个命令
  1. tar cvpzf /TEMP_BACKUPS/backup.tgz --exclude=/proc --exclude=/lost+found --exclude=/tmp --exclude=/TEMP_BACKUPS --exclude=/mnt --exclude=/sys / > /TEMP_BACKUPS/mylog.txt

我收到了这个错误.我试了两次

  1. tar: Removing leading `/' from member names
  2. tar: /dev/log: socket ignored
  3. tar: Removing leading `/' from hard link targets
  4. tar: /selinux/policy: Cannot open: Invalid argument
  5. tar: /var/spool/postfix/public/flush: socket ignored
  6. tar: /var/spool/postfix/public/cleanup: socket ignored
  7. tar: /var/spool/postfix/public/showq: socket ignored
  8. tar: /var/spool/postfix/private/defer: socket ignored
  9. tar: /var/spool/postfix/private/virtual: socket ignored
  10. tar: /var/spool/postfix/private/proxywrite: socket ignored
  11. tar: /var/spool/postfix/private/verify: socket ignored
  12. tar: /var/spool/postfix/private/anvil: socket ignored
  13. tar: /var/spool/postfix/private/lmtp: socket ignored
  14. tar: /var/spool/postfix/private/bounce: socket ignored
  15. tar: /var/spool/postfix/private/relay: socket ignored
  16. tar: /var/spool/postfix/private/scache: socket ignored
  17. tar: /var/spool/postfix/private/retry: socket ignored
  18. tar: /var/spool/postfix/private/error: socket ignored
  19. tar: /var/spool/postfix/private/rewrite: socket ignored
  20. tar: /var/spool/postfix/private/tlsmgr: socket ignored
  21. tar: /var/spool/postfix/private/local: socket ignored
  22. tar: /var/spool/postfix/private/discard: socket ignored
  23. tar: /var/spool/postfix/private/trace: socket ignored
  24. tar: /var/spool/postfix/private/smtp: socket ignored
  25. tar: /var/spool/postfix/private/proxymap: socket ignored
  26. tar: /var/lib/MysqL/MysqL.sock: socket ignored
  27. tar: /var/www/html/run/wsgi.1458.0.1.sock: socket ignored
  28. tar: /var/www/html/run/wsgi.4861.1.1.sock: socket ignored
  29. tar: /var/www/html/run/wsgi.1178.0.1.sock: socket ignored
  30. tar: /var/www/html/run/wsgi.1179.0.1.sock: socket ignored
  31. tar: /var/run/dbus/system_bus_socket: socket ignored
  32. tar: /var/run/abrt/abrt.socket: socket ignored
  33. tar: /var/run/rpcbind.sock: socket ignored
  34. tar: /var/run/portreserve/socket: socket ignored
  35. tar: /var/run/nscd/socket: socket ignored
  36. tar: Exiting with failure status due to prevIoUs errors

我需要做什么来进行完整备份

解决方法

请注意,您的tar命令已成功完成;它只是抱怨套接字条目. Tiffany建议使用一种机制来过滤掉那些特定的错误消息,尽管tar仍会以错误代码退出.

您还可以将一组套接字提供给tar的-X选项,以将它们从备份中排除,例如:

  1. # find / -type s -print > /tmp/sockets-to-exclude
  2. # tar cvpzf /TEMP_BACKUPS/backup.tgz -X /tmp/sockets-to-exclude \
  3. --exclude=/proc --exclude=/lost+found --exclude=/tmp \
  4. --exclude=/TEMP_BACKUPS --exclude=/mnt --exclude=/sys / > /TEMP_BACKUPS/mylog.txt

这种技术的优点是它使tar的退出代码更有用(也就是说,你可以使用退出代码来决定备份是否成功完成).

您还可以通过将其他–exclude选项替换为单个-X(也称为–exclude-from)并简单地将它们列在文件中来缩短命令行.

猜你在找的Linux相关文章