Я хотел создать файл tar gz с наивысшим уровнем сжатия, и я следовал решению по адресу https://superuser.com/a/546509/461740:
tar cv /path/to/directory | gzip -9 > file.tar.gz
Но теперь я не могу распаковать файл, у меня следующая ошибка:
tar: This does not look like a tar archive
tar: Skipping to next header
tar: Archive contains ‘23241_at',16’ where numeric off_t value expected
Я погуглил эту ошибку, в большинстве случаев она вызвана "двойным" сжатием gzip, я попробовал решения, предложенные для этой проблемы, но, похоже, она не соответствует моей проблеме.
Есть идеи, как это исправить?
Редактировать: примечание: когда я вызываю командный file
для несжатого файла (который должен быть файлом tar), я получаю результат: data
.
Изменить: результат head -c512 file.tar | hexdump -C
:
00000000 73 71 6c 5f 64 75 6d 70 2f 0a 73 71 6c 5f 64 75 |sql_dump/.sql_du|
00000010 6d 70 2f 62 67 65 65 46 6f 72 65 69 67 6e 4b 65 |mp/bgeeForeignKe|
00000020 79 2e 73 71 6c 0a 73 71 6c 5f 64 75 6d 70 2f 00 |y.sql.sql_dump/.|
00000030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
*
00000080 00 00 00 00 00 00 00 00 00 00 30 30 30 30 37 35 |..........000075|
00000090 35 00 30 30 30 37 36 34 33 00 30 30 31 31 33 30 |5.0007643.001130|
000000a0 30 00 30 30 30 30 30 30 30 30 30 30 30 00 31 32 |0.00000000000.12|
000000b0 35 33 35 31 36 30 34 34 34 00 30 31 32 37 30 33 |535160444.012703|
000000c0 00 20 35 00 00 00 00 00 00 00 00 00 00 00 00 00 |. 5.............|
000000d0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
*
00000120 00 00 00 00 00 00 00 75 73 74 61 72 20 20 00 66 |.......ustar .f|
00000130 62 61 73 74 69 61 6e 00 00 00 00 00 00 00 00 00 |bastian.........|
00000140 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 75 |...............u|
00000150 6e 69 6c 64 65 65 00 00 00 00 00 00 00 00 00 00 |nildee..........|
00000160 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
*
00000200
После команды @kasperd, чтобы попытаться восстановить мой файл, tail -c+39 file.tar > repaired.tar
, шестнадцатеричный дамп первых 512 байт:
00000000 73 71 6c 5f 64 75 6d 70 2f 00 00 00 00 00 00 00 |sql_dump/.......|
00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
*
00000060 00 00 00 00 30 30 30 30 37 35 35 00 30 30 30 37 |....0000755.0007|
00000070 36 34 33 00 30 30 31 31 33 30 30 00 30 30 30 30 |643.0011300.0000|
00000080 30 30 30 30 30 30 30 00 31 32 35 33 35 31 36 30 |0000000.12535160|
00000090 34 34 34 00 30 31 32 37 30 33 00 20 35 00 00 00 |444.012703. 5...|
000000a0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
*
00000100 00 75 73 74 61 72 20 20 00 66 62 61 73 74 69 61 |.ustar .fbastia|
00000110 6e 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |n...............|
00000120 00 00 00 00 00 00 00 00 00 75 6e 69 6c 64 65 65 |.........unildee|
00000130 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
*
00000200
Результат tar -tvf
для "восстановленного" tar:
drwxr-xr-x username 0 2015-06-08 02:26 sql_dump/
-rw-r--r-- username 19123 2015-06-08 02:25 sql_dump/bgeeForeignKey.sql
tar: Skipping to next header
tar: Archive contains `688_x_at\',1' where numeric off_t value expected
tar: Archive contains `y\',\'not ' where numeric mode_t value expected
tar: Archive contains `725,\'ENSG' where numeric time_t value expected
tar: Archive contains `excluded' where numeric uid_t value expected
tar: Archive contains `\'),(\'208' where numeric gid_t value expected
tar: Archive contains `excluded' where numeric uid_t value expected
tar: Archive contains `\'),(\'208' where numeric gid_t value expected
?rwsrwsrwt 4294967295/4294967295 18446744073709551615 1970-01-01 00:59 ty','not excluded'),('208686_s_at',13725,'ENSG00000204256',7.73,'present',15097863,NULL,'high qualit unknown file type `\''
tar: Skipping to next header
tar: Archive contains `ent\'),(31801' where numeric off_t value expected
tar: Archive contains `no data\'' where numeric mode_t value expected
tar: Archive contains `347,\'ENSG' where numeric time_t value expected
tar: Archive contains `,\'no dat' where numeric uid_t value expected
tar: Archive contains `a\',\'desc' where numeric gid_t value expected
tar: Archive contains `,\'no dat' where numeric uid_t value expected
tar: Archive contains `a\',\'desc' where numeric gid_t value expected
?rwsrwsrwt 4294967295/4294967295 18446744073709551615 1970-01-01 00:59 ,'descent'),(31801346,'ENSG00000104375','UBERON:0007625','HsapDv:0000095','no data','poor quality',' unknown file type `\''
tar: Skipping to next header
tar: Exiting with failure status due to previous errors
Вывод dd if=repaired.tar skip=39 count=2 | hexdump -C
2+0 records in
2+0 records out
1024 bytes (1.0 kB) copied00000000 64 64 20 66 6f 72 65 69 67 6e 20 6b 65 79 20 28 |dd foreign key (|
00000010 64 69 66 66 65 72 65 6e 74 69 61 6c 45 78 70 72 |differentialExpr|
00000020 65 73 73 69 6f 6e 49 64 29 20 72 65 66 65 72 65 |essionId) refere|
00000030 6e 63 65 73 20 64 69 66 66 65 72 65 6e 74 69 61 |nces differentia|
00000040 6c 45 78 70 72 65 73 73 69 6f 6e 28 64 69 66 66 |lExpression(diff|
, 6.9324e-05 s, 14.8 MB/s
00000050 65 72 65 6e 74 69 61 6c 45 78 70 72 65 73 73 69 |erentialExpressi|
00000060 6f 6e 49 64 29 20 6f 6e 20 64 65 6c 65 74 65 20 |onId) on delete |
00000070 73 65 74 20 6e 75 6c 6c 3b 0a 2f 2a 21 34 30 30 |set null;./*!400|
00000080 30 30 20 41 4c 54 45 52 20 54 41 42 4c 45 20 60 |00 ALTER TABLE `|
00000090 64 65 61 52 4e 41 53 65 71 53 75 6d 6d 61 72 79 |deaRNASeqSummary|
000000a0 60 20 45 4e 41 42 4c 45 20 4b 45 59 53 20 2a 2f |` ENABLE KEYS */|
000000b0 3b 0a 0a 00 00 00 00 00 00 00 00 00 00 00 00 00 |;...............|
000000c0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
*
00000200 73 71 6c 5f 64 75 6d 70 2f 52 45 41 44 4d 45 2e |sql_dump/README.|
00000210 74 78 74 0a 73 71 6c 5f 64 75 6d 70 2f 62 67 65 |txt.sql_dump/bge|
00000220 65 49 6e 64 65 78 2e 73 71 6c 0a 73 71 6c 5f 64 |eIndex.sql.sql_d|
00000230 75 6d 70 2f 64 75 6d 70 5f 62 67 65 65 5f 76 31 |ump/dump_bgee_v1|
00000240 33 5f 31 2e 73 71 6c 0a 73 71 6c 5f 64 75 6d 70 |3_1.sql.sql_dump|
00000250 2f 52 45 41 44 4d 45 2e 74 78 74 00 00 00 00 00 |/README.txt.....|
00000260 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
*
000002a0 00 00 00 00 00 00 00 00 00 00 00 00 30 30 30 30 |............0000|
000002b0 36 34 34 00 30 30 30 37 36 34 33 00 30 30 31 31 |644.0007643.0011|
000002c0 33 30 30 00 30 30 30 30 30 30 30 32 30 36 34 00 |300.00000002064.|
000002d0 31 32 35 33 35 31 36 30 31 37 34 00 30 31 34 34 |12535160174.0144|
000002e0 30 33 00 20 30 00 00 00 00 00 00 00 00 00 00 00 |03. 0...........|
000002f0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
*
00000340 00 00 00 00 00 00 00 00 00 75 73 74 61 72 20 20 |.........ustar |
00000350 00 66 62 61 73 74 69 61 6e 00 00 00 00 00 00 00 |.fbastian.......|
00000360 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
00000370 00 75 6e 69 6c 64 65 65 00 00 00 00 00 00 00 00 |.unildee........|
00000380 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
*
00000400