tech:tar_avec_cpio
Différences
Ci-dessous, les différences entre deux révisions de la page.
| Les deux révisions précédentesRévision précédente | |||
| tech:tar_avec_cpio [2025/04/02 11:14] – Jean-Baptiste | tech:tar_avec_cpio [2026/07/03 18:00] (Version actuelle) – Jean-Baptiste | ||
|---|---|---|---|
| Ligne 1: | Ligne 1: | ||
| + | < | ||
| + | {{tag> | ||
| + | |||
| + | # Créer une archive tar depuis un find grâce à cpio | ||
| + | |||
| + | ### Présentation | ||
| + | |||
| + | **cpio** est à la fois le nom d'une __commande__ et d'un __format__ d' | ||
| + | Voir manuel http:// | ||
| + | |||
| + | La commande **cpio** prend aussi en charge d' | ||
| + | |||
| + | |||
| + | ### Tar avec cpio | ||
| + | |||
| + | Utilisez l' | ||
| + | |||
| + | ~~~bash | ||
| + | find . -depth | cpio -ov --format=ustar |pigz > archive.tar.gz | ||
| + | |||
| + | # Équivalent ? | ||
| + | find . -depth | xargs tar czf archive.tar.gz | ||
| + | find . -exec tar rvf archive.tar " | ||
| + | ~~~ | ||
| + | |||
| + | //' | ||
| + | |||
| + | ~~~bash | ||
| + | find . -type f |cpio -ov --format=ustar |pigz > archive.tar.gz | ||
| + | ~~~ | ||
| + | |||
| + | Si vous avez des noms de fichiers avec des espaces et des caractères bizarres | ||
| + | ~~~bash | ||
| + | find . -depth -print0 |cpio -0 -ov --format=ustar |pigz > archive.tar.gz | ||
| + | ~~~ | ||
| + | |||
| + | Il est également possible de créer un tarball depuis un find (ou un **ls**) avec **Pax** qui est à privilégier. | ||
| + | Cependant contrairement à pax, cpio est livré par défaut dans la plupart des distributions. | ||
| + | |||
| + | Voir [Pax](https:// | ||
| + | |||
| + | ### Limitation | ||
| + | |||
| + | Le format d' | ||
| + | |||
| + | * Taille max de l' | ||
| + | * Taille max nom de fichier : 256 caractères grand max (souvent moins) | ||
| + | * Taille max nom lien symbolique : 100 caractères | ||
| + | |||
| + | Voir détails http:// | ||
| + | |||
| + | ### Exemple en pratique | ||
| + | |||
| + | [[debian_conflit_2paquet_meme_fichier]] | ||
| + | |||
| + | ## Autre CPIO | ||
| + | |||
| + | ~~~bash | ||
| + | find . -mount -print | cpio -pdm / | ||
| + | ~~~ | ||
| + | |||
| + | ## Autre | ||
| + | |||
| + | Avec Tar | ||
| + | |||
| + | ~~~bash | ||
| + | tar -cvf allfiles.tar -T mylist.txt | ||
| + | ~~~ | ||
| + | |||
