linux下tar解压时的 Record size = 8 blocks提示。。

本文解释了tar文件生成过程中出现的“Record size=8 blocks”警告的原因,并提供了解决方案。这种警告源于新版本POSIX标准中规定的tar文件块大小为10KB,而非旧版的默认设置。文章建议通过在文件末尾添加零来确保文件大小为10KB的倍数,以消除警告。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

原帖:http://linux.m2osw.com/tar-record-size-blocks

http://archives.linuxfromscratch.org/mail-archives/lfs-support/2009-November/036933.html

The tar utility has changed over time and older versions would generate what is viewed as incompatible files. Although most tar utilities will still support older version (before 1988), the may generate this one warning:

   tar: Record size = 8 blocks

I tried, a couple times, to create tar files and they worked just fine but I would get this warning... This is rather annoying so I looked in a way to avoid the warning. Why do you think we get it?

The answer is in the newest versions of POSIX the block size of a tar file was decided to be 10Kb. Internally, the block sizes are still 512 bytes, but when you generate a tar file, you must make sure that the final file is a multiple of 10Kb or you get this warning.

The warning is safe for disk files, however, it lets you know that your tar file may not be compatible with all tape drives available, so of which may even require larger blocks (i.e. 20Kb, 32Kb, etc.)

So... all you have to do is add a bunch of zeroes at the end of the file. If you file system is setup to have sparse files, it shouldn't be wasting any space on your hard drive. Although, you should keep the tarball compressed with gzip or bz2. That way the zeroes more or less disappear.


The only harm this will cause is that perl's testsuite will fail
because of this warning, and in order to stop that warning from
appearing on disks, we can backport that patch to 1.22, or just wait
till 1.23.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值