1. Backing Up Data
cp <-> rsync
- rsync is more efficient, because it checks if the file being copied already exists.
- rsync copies only the parts of files that have actually changed, it can be very fast
- cp can only copy files to and from destinations on the local machine (unless mounted using NFS), rsync can also be used to copy files from one machine to another.
- someone@host:path
2. Using rsync
a very useful way to back up a project directory might be to use the following command.
rsync -r project-X archive-machine:archives/project-X
3. Compressing Data
command | usage |
---|---|
gzip | |
bzip2 | produces files significantly smaller than those produced by gzip |
xz | the most space-efficient compression utility used in Linux |
zip | is often required to examine and decompress archives from other operating systems |
tar utility is often used to group files in an archive and then compress the whole archive at once.
tar Jczf mydir.tar.xz mydir
tar xvf mydir.tar.xz
10. Disk-to-Disk Copying (dd)
first 512 byte sector on the disk that contains a table describing the partitions on that disk.
dd if=/dev/sda of=sda.mbr bs=512 count=1