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

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

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

tar: Removing leading `/' from member names
tar: /dev/log: socket ignored
tar: Removing leading `/' from hard link targets
tar: /selinux/policy: Cannot open: Invalid argument
tar: /var/spool/postfix/public/flush: socket ignored
tar: /var/spool/postfix/public/cleanup: socket ignored
tar: /var/spool/postfix/public/showq: socket ignored
tar: /var/spool/postfix/private/defer: socket ignored
tar: /var/spool/postfix/private/virtual: socket ignored
tar: /var/spool/postfix/private/proxywrite: socket ignored
tar: /var/spool/postfix/private/verify: socket ignored
tar: /var/spool/postfix/private/anvil: socket ignored
tar: /var/spool/postfix/private/lmtp: socket ignored
tar: /var/spool/postfix/private/bounce: socket ignored
tar: /var/spool/postfix/private/relay: socket ignored
tar: /var/spool/postfix/private/scache: socket ignored
tar: /var/spool/postfix/private/retry: socket ignored
tar: /var/spool/postfix/private/error: socket ignored
tar: /var/spool/postfix/private/rewrite: socket ignored
tar: /var/spool/postfix/private/tlsmgr: socket ignored
tar: /var/spool/postfix/private/local: socket ignored
tar: /var/spool/postfix/private/discard: socket ignored
tar: /var/spool/postfix/private/trace: socket ignored
tar: /var/spool/postfix/private/smtp: socket ignored
tar: /var/spool/postfix/private/proxymap: socket ignored
tar: /var/lib/MysqL/MysqL.sock: socket ignored
tar: /var/www/html/run/wsgi.1458.0.1.sock: socket ignored
tar: /var/www/html/run/wsgi.4861.1.1.sock: socket ignored
tar: /var/www/html/run/wsgi.1178.0.1.sock: socket ignored
tar: /var/www/html/run/wsgi.1179.0.1.sock: socket ignored
tar: /var/run/dbus/system_bus_socket: socket ignored
tar: /var/run/abrt/abrt.socket: socket ignored
tar: /var/run/rpcbind.sock: socket ignored
tar: /var/run/portreserve/socket: socket ignored
tar: /var/run/nscd/socket: socket ignored
tar: Exiting with failure status due to prevIoUs errors

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

解决方法

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

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

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

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

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

原文链接:https://www.f2er.com/linux/400166.html

猜你在找的Linux相关文章