Site Tools


archiving

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
archiving [2012/07/25 23:16] paulsmitharchiving [2015/03/12 00:47] (current) paulsmith
Line 1: Line 1:
 +====== Archiving ======
  
 +
 +===== Unpack a archive =====
 +<code>
 +gzip -cd filename.tar.gz | tar -xvf -
 +tar xvzf filename.tar.gz
 +tar xvzf filename.tgz
 +bzip2 -cd file.tar.bz2 | tar xvf -
 +tar  xjvf filename.tar.bz2
 +</code>
 +
 +
 +===== Create a archive file =====
 +  tar -zcvf backup.tar.gz /usr/local/path
 +
 +
 +  tar -cjvpf ../LEP-host1-20100421.tar.bz2 ./
 +  tar -cjvpf ../LEP-host1-20100421.tar.bz2 ./ --exclude="./usr/local/vmware/*"
 +
 +===== patching =====
 +<code>
 +
 +</code>
 +
 +===== rsync =====
 +  rsync --progress -avxzlD --stats -EH /var/www/ /mnt/cdrom/
 +  rsync -avlDx -EHp -e ssh root@203.27.127.xxx:/path /targetpath/
 +
 +
 +===== cp =====
 +  cp -xvpav /mnt/src/* /mnt/dst/
 +
 +
 +<code>
 +parts="home opt usr var tmp video vmware"
 +for part in $parts
 +do
 + mount /dev/vx/$part /mnt/src
 + mount /dev/vg/$part /mnt/dst
 + sleep 5
 +
 + cp -xvpav /mnt/src/* /mnt/dst/
 + sync
 + sync
 + sleep 5
 +
 + umount /mnt/src
 + umount /mnt/dst
 +
 +done
 +</code>
 +
 +===== copy a partition =====
 +  dd if=/dev/sda1 of=/dev/sdb1 bs=4096 conv=notrunc,noerror
 +  
 +  
 +===== Unrar a series =====
 +<code>
 +list=$(ls -d -1 /thepath/*)
 +for line in $list; do thefile="$line/*.rar"; echo "$thefile\n";unrar e $thefile; done
 +</code>