Ungazigcina njani iifayile kunye nezalathiso usebenzisa i-tar kwiLinux

Ngu-Emmett Dulaney

Kwiinkqubo zeLinux, ungasebenzisa tar umyalelo wokugcina iifayile kwisixhobo, njengehard drive okanye itheyiphu. I tar Inkqubo kwiLinux yenza ifayile yogcino enokuqulatha ezinye izikhombisi kunye neefayile kwaye (ngokuzikhethela) icinezele ugcino ukuze kugcinwe ngokufanelekileyo. Emva koko ugcino lubhaliwe kwisixhobo esikhankanyiweyo okanye kwenye ifayile. Iiphakheji ezininzi zesoftware zisasazwa ngohlobo lokucinezelwa tar ifayile.



Umyalelo we-syntax wenkqubo ye-tar kwi-Linux ngolu hlobo lulandelayo:



options

Apha, tar Ngokwesiqhelo ichazwa ngokulandelelana konobumba omnye, unobumba ngamnye echaza ukuba yintoni _ _ + _ | yenza; destination ligama lesixhobo sefowuni yogcino; kwaye source Uluhlu lwamagama efayile okanye isikhombisi esichaza iifayile eziza kugcinwa.

Ukuxhasa kunye nokubuyisela kwindawo yokugcina umthamo omnye kwiLinux

Masithi ufuna ukubuyela kwimixholo | /etc/X11 ulawulo kwi-hard drive. Ngena njenge root, kwaye uchwetheze lo myalelo ulandelayo, apho xxx imele ukuqhuba kwakho:



tar

I zcvf Inkqubo ibonisa uluhlu lwamagama efayile njengoko ifayile nganye ikhutshelwa kugcino lwetar olucinezelweyo. Kule meko, ukhetho zi /dev/ xxx , indawo ekuyiwa kuyo ngu /etc/X11 (ukuqhuba), kwaye umthombo ngu tar | isikhombisi (esichaza zonke izikhombisi zekhompyuter kunye nemixholo yazo). Ungasebenzisa efanayo /dev/st0 umyalelo wokugcina iifayile kwi-tape ngokutshintsha indawo ye-hard drive kunye nefowuni, njenge tar yetape drive ye-SCSI.

Le tafile ichaza ezimbalwa eziqhelekileyo tar ukhetho kwiLinux.

Iinketho eziqhelekileyo zeta
Ukhetho Ngaba oku kulandelayo
c Yenza indawo yokugcina entsha.
f Icacisa igama lefayile yokugcina okanye isixhobo kwicandelo elilandelayo kumgca wokuyalela.
M Icacisa indawo yogcino lwe-multivolume.
t Uluhlu lwemixholo yogcino.
v Ibonisa imiyalezo yezenzi.
x Ikhupha iifayile kwindawo yogcino.
nge Icinezela indawo yokugcina itha ngokusebenzisa i-gzip.

Ukujonga imixholo | /etc/X11 indawo yokugcina oyenzayo kwi-drive, chwetheza lo myalelo ulandelayo (ukubuyisela xxx ngesixhobo sedrive):



tar

Ubona uluhlu lwamagama efayile (nganye iqala ngo t |) ebonisa into esekweni. Kule tar umyalelo, tar Uluhlu lwezinto ezikhethiweyo | root yogcino.

Ukukhupha iifayile kwi | _ _ + _ | backup, landela la manyathelo ngelixa ungene njengo /tmp:

  1. Guqula isikhombisi sibe tar Ngokuchwetheza lo myalelo: tar

    Eli nyathelo kulapho unokuziqhelanisa nokukhupha iifayile kwi x | yogcino. Ukufumana ugcino lwangempela, tshintsha umkhombandlela kwindawo efanelekileyo. (Ngokwesiqhelo uchwetheza cd / .)

  2. Chwetheza lo myalelo ulandelayo: /tmp

    Oku tar umyalelo usebenzisa etc/X11 ukhetho lokukhupha iifayile kwindawo yokugcina egcinwe kwisixhobo (buyisela xxx Ngokuqhuba).

Ngoku ukuba ujonga imixholo ye /tmp | ulawulo, uyaqaphela ukuba tar Umyalelo wenza tar Umthi wolawulo ku / kwaye ibuyisela zonke iifayile kwi /etc/X11 | yogcino kulawulo. I -C Imicu yomyalelo ekhokelayo root isuka kumagama efayile yogcino kwaye ibuyisele iifayile kulawulo lwangoku. Ukuba ufuna ukubuyisela / isikhombisi esigciniweyo, sebenzisa lo myalelo (endaweni yegama lesixhobo se xxx ):

tar

I / ukhetho lutshintsha imikhombandlela kulawulo oluchaziweyo (kule meko, tar isikhombisi se M) ngaphambi kokwenza z; M Ekupheleni komyalelo kuchaza umkhombandlela apho ufuna ukubuyisela khona iifayile zokugcina.

ungayithatha i-naproxen nge-prednisone

Kwiinkqubo zeLinux, ungasebenzisa tar umyalelo wokwenza, ukujonga, kunye nokubuyisela indawo yogcino. Ungagcina indawo yokugcina kwifayile okanye kuso nasiphi na isixhobo osichazayo ngegama lefowuni.

Ukuxhasa kunye nokubuyisela kwindawo yokugcina izinto ezininzi kwiLinux

Ngamanye amaxesha, amandla endawo yokugcina enye angaphantsi kwendawo yokugcina efunekayo yokugcina indawo yokugcina. Kule meko, ungasebenzisa tar ukhetho kugcino lwe-multivolume, okuthetha ukuba indawo yogcino inokwenza iiteyiphu ezininzi. Qaphela, nangona kunjalo, ukuba awungekhe wenze uxinzelelo, indawo yogcino lwe-multivolume, ke kuya kufuneka ulahle tar ukhetho.

I tar uxelele /tmp ukwenza ugcino lwe-multivolume. I /tmp Umyalelo uyakunyusa kwimidiya yesibini xa eyokuqala igcwalisiwe. Thatha imithombo yeendaba yokuqala kwaye ufake enye xa ubona oku kulandelayo:

tar

Xa ucinezela u-Enter, du -s Inkqubo iyaqhubeka kunye nemithombo yeendaba yesibini. Kovimba abagciniweyo abakhulu, /etc Inkqubo iyaqhubeka ukukhuthaza amajelo eendaba amatsha njengoko kufuneka.

Ukubuyisela kule ndawo yogcino lwe-multivolume, chwetheza cd / tmp Ukutshintsha isikhombisi sibe /etc. (I tar isetyenziselwa isikhombisi ngeenjongo zokubonisa, kodwa kuya kufuneka usebenzise isikhombisi sokwenyani xa ubuyisela iifayile kwindawo yogcino.) Emva koko chwetheza (endaweni yoko xxx ngesixhobo osisebenzisayo)

tar

I /dev/st0 Inkqubo ikukhuthaza ukondla imithombo yeendaba njengoko kufanelekile.

Sebenzisa tar umyalelo wokumisela inani lokugcina olifunayo kugcino lwencwadi. Chwetheza ii-du -s / njl njl. Ukuze ubone ubungakanani bebonke be /dev/st0 umkhombandlela kwii-kilobytes, umzekelo. Nantsi imveliso eqhelekileyo evela kuloo myalelo:

tar

Iziphumo ezikhutshelweyo zibonisa ukuba tar | ulawulo lufuna ubuncinci i-35,724 kilobytes yendawo yokugcina ukuze igcinwe.

Ukuxhasa iiteyiphu kwiinkqubo zeLinux

Nangona ukuxhasa kwiiteyiphu kulula njengokusebenzisa igama lesixhobo esifanelekileyo kwi | _ _ + _ | Umyalelo, kufuneka uyazi eminye imiba yesixhobo setape ukuze usisebenzise kakuhle. Xa usebenzisa /dev/nst0 ukubuyela umva kwisixhobo esinegama mt (i-drive yokuqala ye-SCSI drive), isixhobo seteyiphu sibuyisela umva ngokuzenzekelayo kwi tape xa /dev/nst0 Inkqubo igqibile ukukopa kwindawo yogcino kwi tape. I mt isixhobo sibizwa ngokuba yi iteyiphu yokubuyisela umva kwakhona kuba ibuyisela umva amakhasethi ngokungagqibekanga.

Ukuba itheyiphu yakho inokubamba iigigabytes ezininzi zedatha, unokufuna ukubhala uninzi tar xvf oovimba - omnye emva komnye - kwiteyipu efanayo. (Ngaphandle koko, okuninzi kwiteyiphu kungashiywa kungenanto.) Ukuba uceba ukwenza njalo, isixhobo sakho se khasethi asinakubuya umva emva kweteyiphu tar Inkqubo igqityiwe. Ukukunceda ngemeko enje ngale, izixhobo zetheyiphu ezili-Linux azibuyisi mva. Isixhobo se-SCSI esingabuyisi esibizwa ngokuba yi find. Sebenzisa eli gama lesixhobo ukuba ufuna ukubhala enye yogcino emva kwenye kwitheyiphu.

Emva kogcino ngalunye, isixhobo seteyipu esingabuyisiyo sibhala isiphelo sefayile (i-EOF) yokuzahlula enye indawo yokugcina elandelayo. Sebenzisa -mtime -1 umyalelo wokulawula itape; ungasusa kwesinye isiphawuli siye kwesinye okanye ubuyisele umva iteyiphu. Xa ugqibile ukubhala ugcino oluninzi kwitheyiphu usebenzisa find igama lesixhobo, umzekelo, unokunyanzela itape ukubuyela umva ngalo myalelo ulandelayo:

tar

Emva kokubuyela umva kwiteyipu, ungasebenzisa lo myalelo ulandelayo ukukhupha iifayile kwindawo yokugcina kwindawo yokugcina yediski yangoku:

tar

Emva koko, kuya kufuneka udlule kwimakishi ye-EOF uye kwindawo yokugcina elandelayo. Ukwenza njalo, sebenzisa oku kulandelayo crontab myalelo:

crontab

Lo myalelo ubeka i-tape ekuqaleni kogcino olulandelayo. Ngoku sebenzisa root yiyalela kwakhona ukuba ufunde olu londolozo.

Ukuba ugcina indawo yogcino oluninzi kwikhasethi, kuya kufuneka ugcine umkhondo wogcino-mpepha ngokwakho. Ukulandwa koovimba kunokuba nzima ukukhumbula, kungangcono ukuba ugcine ngokugcina enye kwikhasethi ngalinye.

Ukwenza i-backups ekhulayo kwi-Linux

Masithi usebenzisa backups ukubuyisela umva i-hard drive yenkqubo yakho kwikhasethi. Ngenxa yokuba ukwenza isipele ngokupheleleyo kunokuthatha ixesha, awufuni kuwuphinda lo msebenzi rhoqo ebusuku. (Ngaphandle koko, linani elincinci kuphela leefayile elinokuthi litshintshe emini.) Ukufumana iifayile ezifuna ukuxhaswa, ungasebenzisa crontab ukuyalela ukuba zidweliswe zonke iifayile eziguqukileyo kwiiyure ezingama-24 ezidlulileyo:

tar  options destination source  

Lo myalelo uprinta uluhlu lweefayile ezitshintshileyo kusuku oludlulileyo. I

tar zcvf /dev/  xxx  /etc/X11
ukhetho luthetha ukuba ufuna iifayile ezigqityelwe ukuguqulwa ngaphantsi komhla omnye odlulileyo. Ngoku ungadibanisa le
tar ztf /dev/  xxx  
umyalelo nge
cd /tmp
ukuyalela ukugcina kuphela ezo fayile zitshintshileyo kusuku oludlulileyo:

tar zxvf /dev/  xxx  

Xa ubeka umyalelo phakathi kweempendulo ezibuyela umva, iqokobhe liwenza loo myalelo kwaye libeke iziphumo ngelo xesha kumgca wokuyalela. Iziphumo kukuba

tar zxvf /dev/  xxx  -C /
Inkqubo igcina kuphela iifayile eziguqulweyo kugcino. Le nkqubo ikunika ukhuphelo lokongezwa kweefayile kuphela ezitshintshileyo kusuku olungaphambili.

Ipilisi emhlophe engqukuva 524

Ukwenza i-backups ezenzekelayo kwiLinux

Kwiinkqubo zeLinux, ungasebenzisa

Prepare volume #2 and hit return:
ukuseta imisebenzi ephindaphindayo (ebizwa ngokuba yi- imisebenzi yekron ). Inkqubo yeLinux yenza le misebenzi rhoqo. Ukuxhasa inkqubo yakho kusetyenziswa kakuhle
tar xvfM /dev/  xxx  
isibonelelo. Masithi isicwangciso sakho sokugcina silolu hlobo lulandelayo:

  • Rhoqo ngeCawa ngo-1: 15 kusasa, inkqubo yakho ixhasa yonke i-hard drive kwiteyiphu.
  • NgoMvulo ukuya ngoMgqibelo, inkqubo yakho yenza ugcino olongezelelekileyo ngo-3: 10 kusasa ngokugcina kuphela ezo fayile zitshintshileyo kwiiyure ezingama-24 ezidlulileyo.

Ukuseta le shedyuli yogcino oluzenzekelayo, ngena |

35724 /etc
, kwaye uchwetheze le migca ilandelayo kwifayile enegama
mt -f /dev/nst0 rewind
(uthatha ukuba usebenzisa i-SCSI tape drive):

tar xvf /dev/nst0

Emva koko, ngenisa le shedyuli yomsebenzi usebenzisa oku kulandelayo

mt -f /dev/nst0 fsf 1
myalelo:

find / -mtime -1 -type f -print

Ngoku usethelwe indawo yogcino ezenzekelayo. Konke okufuneka ukwenze kukubeka iteyiphu entsha kwi-tape drive yonke imihla. Khumbula kwakhona ukunika iteyiphu nganye ileyibhile efanelekileyo.