How to Create a Multi Part Tar File with Linux Kā izveidot Multi daļas Darvas failu ar Linux

by Sukrit Dhandhania on May 25, 2009 ar Sukrit Dhandhania 2009 May 25,

Linux

Sometimes when you want to store your backup or any other large set of files online or want to share them someone else you need to find a way to compress and split the files into chunks of 100 or more Megabytes. Dažreiz, ja vēlaties saglabāt savu rezerves vai citu daudzas failu tiešsaistē vai vēlaties dalīties ar viņiem kāds cits jums nepieciešams atrast veidu, lai saspiestu un sadalīt failus gabali ir 100 vai vairāk megabaiti. I felt the need for this as well recently when I wanted to store my backups online and the online storage service had a cap of 100 MB per file. Es jutu vajadzību, lai tas, tāpat kā nesen, kad es gribēju saglabāt mans backups tiešsaistē un tiešsaistes uzglabāšanas pakalpojums tika vāciņu ar 100 MB per file. I found a really neat solution based on the tar command. Es atklāju tiešām veikls risinājums, kas balstīts uz tar komandu. Using this method I split my backup of about 1 GB into 10 chunks of 100 MB each with incremental filenames. Izmantojot šo metodi es sadalīts mans backup aptuveni 1 GB stājās 10 gabalus 100 MB katra ar papildu failu nosaukumi.

The 1 GB file I wanted to split was called dbbackup.db . 1 GB failu gribēju sadalīt sauca dbbackup.db. Here's the command I ran to create multiple tar files of 100 MB each out of it: Šeit ir komanda I ilga, lai izveidotu vairākus tar failus 100 MB katra no tā:

# tar -cf – dbbackup.db | split -b 100m – db_backup.tar # Tar-cf - dbbackup.db | split-b 100m - db_backup.tar

This command took a long time to run. Šī komanda bija daudz laika, lai darbotos. Once it was done running I was left with ten files, 100 MB each named db_backup.taraa , db_backup.tarab , db_backup.tarac , and so on and so forth. Kad tas tika izdarīts rādīt man palika desmit failiem, 100 MB katra nosauktā db_backup.taraa, db_backup.tarab, db_backup.tarac, un tā tālāk un tā tālāk.

Now I can copy these files to my external storage or ship them with ease. Tagad es varētu pārkopēt failus uz manu ārējās glabāšanas vai nosūtīt tos ar vieglumu. To stitch the 1GB file back together all I need to do is to run the following command: Uz sašūtiem 1GB failu atpakaļ kopā visas man ir jādara, ir palaist šādu komandu:

# cat db_backup.tara* | (tar x) # Cat db_backup.tara * | (darvas x)

And voila, I get my original file again. Un voila, man manu sākotnējo failu vēlreiz.

Related Posts: Related Posts:
  • How To Apply Custom Themes To Windows XP SP3 Kā pieteikties Custom tematus Windows XP SP3
  • How to encrypt your Linux backups Kā lai šifrētu savu Linux backups
  • Simplehelp Recap: May 2007 – wow, and thank you! Simplehelp Atgādinājums: May 2007 - wow, un paldies!
  • How to save the output of a Linux command to a file Kā lai saglabātu jaudu Linux komandu failu
  • Linux command line magic – find and replace Linux komandrindas burvju - atrast un nomainīt
  • Get Simple Help tutorials just like this one in your email inbox every day - for free! Get Simple Palīdzība konsultācijas tāpat kā šo vienu savā e-pastā ik dienas - bez maksas! Just enter your email address below: Vienkārši ievadiet savu e-pasta adresi:

    You can always opt out of this email subscription at any time. Jūs vienmēr varat atteikties no šīs e-pasta abonementu jebkurā laikā.

    { 1 trackback } (1 Trackback)

    Articles Collection of May'09 « Dako-Tux Raksti kolekcija May'09 "Dako-Tux
    06.24.09 at 6:14 am 06.24.09 at 6:14

    { 2 comments… read them below or (2 comments ... lasīt tos zem vai add one pievienot vienu } )

    1 1 Don Birdsall Don Birdsall 05.26.09 at 5:50 am 05.26.09 at 5:50

    Perhaps I am missing something. Varbūt es esmu missing something. For a single large file why not simply use the split command by itself? Par vienu lielu failu kāpēc ne vienkārši izmanto split komanda pati par sevi? Executing a single command might be faster than executing both tar and split. Izpildot vienu komandu var būt ātrāks nekā izpildes gan darvu un sadalīts.

    split –bytes=1024b sdbackup.db db_backup_ split-bytes = 1024b sdbackup.db db_backup_
    cat db_backup_* > joined_file.db kaķis db_backup_ *> joined_file.db

    2 2 Neil 05.26.09 at 1:19 pm At 1:19 05.26.09 Neil

    Perhaps a better example would show the same operation used on multiple folders Varbūt labāk piemērs varētu parādīt pašas operācijas izmanto vairākas mapes

    # tar -cf – /var/www /var/ftp | split -b 100m – my_backup.tar # Tar-cf - / var / www / var / ftp | split-b 100m - my_backup.tar

    To guard against missing or damaged pieces, install “par2cmdline”, and create parity files so that you can repair missing pieces. Lai izsargātos no trūkstošās vai bojātās daļas, instalējiet "par2cmdline", un izveidot paritātes failus, lai varat remontam trūkstošos gabalus.

    To create parity files with a 15% redundency: Lai izveidotu vienlīdzīgus failus ar 15% redundency:
    # par2 create -r15 my_backup.tara* # Par2 create-r15 my_backup.tara *
    To verify: Pārbaudītu:
    # par2 verify my_backup.taraa.par2 # Par2 pārbaudīt my_backup.taraa.par2
    To repair missing pieces: Remonta trūkst gabali:
    # par2 repair my_backup.taraa.par2 # Par2 remonts my_backup.taraa.par2
    To combine the pieces and extract: Apvienot gabaliņos un ekstrakts:
    # cat my_backup.tara? # Cat my_backup.tara? | (tar x) | (Darvas x)

    Leave a Comment Leave Comment

    You can use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> Jūs varat izmantot šos HTML tagus un atribūtus: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>