Archive for February, 2011
HOWTO: Backup files with tar
by BhoMerT on Feb.09, 2011, under Belajar IT, Copas, Note
Posted by Jason on Sunday July 01, @12:37PM
from the It’s-Sticky-Fun-Fun-Fun dept.
TAR is the Unix Tape ARchive utility. It can be used to either store data on a streaming tape device like a DAT drive, or store files in what is commonly called a tarball file- somewhat like a pkzip file, only compression is optional.
Source
[The basics]
In these examples, I will use the following file structure: a top level directory called DIR1 containing the files picture.jpg, document.doc and database.db.
DIR1/
DIR1/picture.jpg
DIR1/document.doc
DIR1/database.db
[Creating a tarball]
If we were in the directory DIR1 and wanted to backup all the files to a tarball called backup.tar, we could issue this command:
$ tar cvf backup.tar .
./
picture.jpg
doucment.doc
database.db
tar: backup.tar is the archive; not dumped
Note:
c=create (an archive)
v=verbose (just because)
f=filename (the name of our tarball)
.=current directory (what’s going to be backed up)
Also worth mentioning is that by default tar is recursive- meaning it will back up all files and subdirectories recursively unless you otherwise specify with the n flag (non-recursive)
[Displaying the Contents of a Tarball]
The current directory will now contain a file called backup.tar. To display the contents of the tarball file, we could issue this command:
$ tar tvf backup.tar
drwxr-xr-x root/gci 0 Jun 29 10:10 ./
-rw-r–r– root/gci 1 Jun 29 10:10 picture.jpg
-rw-r–r– root/gci 1 Jun 29 10:10 document.doc
-rw-r–r– root/gci 1 Jun 29 10:10 databse.db
Note:
t=table of contents (list)
v=verbose (display all info)
f=filename (backup.tar)
[Extracting Data from a Tarball]
To extract the entire contents of the tarball to the current directory, we can type:
$ tar xvf backup.tar
./
picture.jpg
doucment.doc
database.db
Note:
x=extract
v=verbose
f=filename (backup.tar)
To extract only the picture.jpg file from the archive, type the following command:
$ tar xvf backup.tar picture.jpg
Alternatively, you can use wild cards in either the creation or extraction of a tarball. To extract all jpg files from our archive, we can use a command like this:
$ tar xvf backup.tar *.jpg
[Using Compression]
If you would also like to add compression to your tarballs, you can combine the gzip utility with tar on the command line by adding the z switch to the command. Usually when this is done, we change the suffix of our tarball filename from .tar to either .tgz or .tar.gz. This will let whoever sees the file know that it is a gzipped tarball.
$ tar zcvf tarball.tgz .
Note:
z=gzip compression
c=create
v=verbose
f=filename (backup.tgz)
.=current directory (what to backup)
[Permissions with tar]
If you would like to preserve the permissions of the files you backup, use the p option with the tar command. This will save the uid, gid as well as the specific permission attributes of the files (read, write, execute etc.)
$ tar pzcvf tarball.tgz .
You should also use the p option with the tar extraction command:
$ tar pxvf tarball.tgz .
[Using tar with a Tape Drive]
I use tar in conjunction with my Seagate DAT drive. If you issue any of the previous commands in this HOW-TO without the f option and a tarball filename, you will find that tar will default to writing the files to the device /dev/rsa0 (raw sequential access device 0). Basically this is your first SCSI tape drive. If you have more than one tape drive you would like to use, you can issue the f option and the device name (rsa0, rsa1 etc.) of your specific tape drive instead of a filename.
Examples:
Backing up the current directory to Tape:
$ tar cv . <- default tape drive (rsa0)
$ tar cvf /dev/rsa1 . <- second tape drive (rsa1)
Restore files from Tape:
$ tar xv .
$ tar xvf /dev/rsa1
So, there are the basics of tar. If you would like more information on the tar command, try the man pages.
man tar
Share on FacebookFreeBSD configurasi dasar
by BhoMerT on Feb.02, 2011, under Belajar IT, Ngoprek
=======
CVSUP :
=======
# cd /usr/ports/net/cvsup-without-gui
# make all install clean
# mkdir -p /usr/local/etc/cvsup/sup
# vi /usr/local/etc/cvsup/sup/supfile :
*default host=cvsup.FreeBSD.org
*default base=/usr/local/etc/cvsup
*default prefix=/usr
*default release=cvs tag=RELENG_7_1
*default delete use-rel-suffix
*default compress
src-all
ports-all tag=.
doc-all tag=.
# vi /usr/local/etc/cvsup/sup/refuse :
doc/de
doc/de_*
doc/es
doc/es_*
doc/fr
doc/fr_*
doc/it
doc/it_*
doc/ja
doc/ja_*
doc/nl
doc/nl_*
doc/ru
doc/ru_*
doc/sr
doc/sr_*
doc/zh
doc/zh_*
ports/chinese
ports/french
ports/german
ports/hebrew
ports/japanese
ports/korean
ports/russian
ports/ukrainian
ports/vietnamese
# cd /usr/ports/ports-mgmt/portupgrade
# make all install clean
# vi /usr/local/bin/cvsrun :
—isi file cvsrun—
#! /bin/sh
# cvsrun – Weekly CVSup Run
echo “Subject: `hostname` weekly cvsup run”
/usr/local/bin/cvsup -g -L 2 /usr/local/etc/cvsup/sup/supfile
echo “”
if [ $# -eq 1 ] ; then
if [ $1 = "-i" ] ; then
/usr/local/sbin/portsdb -Uu 2>&1
echo
fi
fi
echo “”
echo “Monggo di lanjut kang…”
—isi file cvsrun—
# chmod 0700 /usr/local/bin/cvsrun
# /usr/local/bin/cvsrun -i
————
isi kernel :
————
tambahin/edit ini nih di kernel, trus compile…
options SCHED_ULE
device vlan
options DEVICE_POLLING
options HZ=2000
options P1003_1B_SEMAPHORES
options SEMMNI=100
options SEMMNS=4096
options SEMMNU=512
options SEMMSL=4096
options SEMOPM=512
options MSGMNB=32768
options MSGMNI=82
options MSGSEG=4098
options MSGSSZ=128
options MSGTQL=2048
options SHMSEG=128
options SHMMNI=4096
options SHMMAX=2147483648
options SHMALL=2097152
options SHMMAXPGS=65536
options IPSTEALTH
options FDESCFS
options MAXDSIZ=”(1024UL*1024*1024)”
options MAXSSIZ=”(128UL*1024*1024)”
options DFLDSIZ=”(1024UL*1024*1024)”
options BLKDEV_IOSIZE=8192
options INCLUDE_CONFIG_FILE
options TCP_SIGNATURE
options IPSEC
maxusers 384
device crypto
device cryptodev
options SMP
device cpufreq
——————————————-
compile pake yg ini, jgn yg standar…
cd /usr/src
make buildkernel KERNCONF=
make installkernel KERNCONF=
reboot
——————————————-
——————
isi sysctl.conf :
——————
net.link.ether.inet.log_arp_wrong_iface=0
net.link.ether.inet.log_arp_movements=0
net.inet.ip.fastforwarding=1
#
kern.coredump=0 # no coredumps
vm.swap_enabled=0 # no swap space
net.inet.ip.redirect=0 # don’t send redirects
net.inet.icmp.drop_redirect=1 # don’t accept redirects
net.inet.tcp.delayed_ack=0 # no delayed ACKs
###
# TAMBAHAN 29Juni2007
###
kern.ipc.maxsockbuf=16777216
kern.ipc.somaxconn=8192
net.inet.tcp.recvbuf_max=16777216
net.inet.tcp.sendbuf_max=16777216
net.inet.tcp.sendspace=262144
net.inet.tcp.recvspace=262144
net.inet.tcp.inflight.enable=0
#
# TAMBAHAN 06Jan2008
#
net.inet.tcp.blackhole=2
net.inet.udp.blackhole=1
net.inet.ip.random_id=1
net.inet.udp.maxdgram=57344
kern.polling.burst_max=1000
kern.polling.each_burst=120
kern.polling.idle_poll=0 # nilai 1 respon lbh baek tp makan cpu-system
kern.polling.user_frac=5
kern.polling.reg_frac=50
net.inet.tcp.tso=0
#
# 28 Mei 2008, R
#
net.inet.tcp.syncookies=0
————————————-
tambahan buat rc.conf :
———————–
inetd_enable=”NO”
background_fsck=”YES”
syslogd_enable=”YES”
syslogd_program=”/usr/sbin/syslogd”
syslogd_flags=”-ss”
tcp_drop_synfin=”YES”
icmp_drop_redirect=”YES”
icmp_log_redirect=”NO”
clear_tmp_enable=”YES”
tcp_extensions=”YES”
tcp_keepalive=”YES”
icmp_bmcastecho=”NO”
icmp_bandlim=”YES”





