This method backups only files that have changed since the last backup. If a file has been deleted it will delete the equivalent file in the backup folder.
rsync -a source_directoy --delete destination
Usually, the backup location will be another PC, which can be done like this;
rsync --rsh=/usr/bin/ssh source_dir destIP:/destination_dir
eg:
rsync --rsh=/usr/bin/ssh ~ 10.1.1.2:/usr/backups/brett
will back up your home directory
Notes:
You can use a name instead of an IP address
Exclude unwanted files with the --exclude="filename" argument;
The above example will require a user account using the same name on both PC's
The destination PC will require ssh server software
sudo-apt-get install openssh-server
Saturday, 26 July 2008
Bit-Copy a Hard Disk Over A Network
This method creates a
On the server (destination of the image file)
On the PC (disk to be backed up)
5000 is the listen port, you can choose any unused port you like
To restore the disk;
On the receiver (where the physical disk is)
On the server (where the disk image is)
disk image file for the backup using dd and nc (netcat). See also rsyncOn the server (destination of the image file)
nc -l 5000 | of=disk.dd.gz
On the PC (disk to be backed up)
dd if=/dev/sda | gzip -9 | nc -q 5 hostname 5000
5000 is the listen port, you can choose any unused port you like
To restore the disk;
On the receiver (where the physical disk is)
nc -l 5000 | gunzip | dd of=/dev/sda
On the server (where the disk image is)
dd if=disk.dd.gz | nc -q 5 hostname 5000
Saturday, 12 July 2008
Extracting files from an ISO image
dd if=/dev/cdrom of=/directoy
Thursday, 10 July 2008
Creating an ISO image from a directory
If you want to create an ISO image from the files contained inside a directory you can use mkisofs;
If you get an error that the file will be bigger than 4GiB-1 then use this command;
mkisofs -J -r -o filename.iso path/to/filesIf you get an error that the file will be bigger than 4GiB-1 then use this command;
mkisofs -allow-limited-size -udf -J -r -o filename.iso path/to/files
Tuesday, 8 July 2008
Switching between versions of Java
If you install Sun Java you may end up with two versions of java on your system. To select which one is active use this command;
sudo update-alternatives --config java
sudo update-alternatives --config java
Thursday, 3 July 2008
Converting an RPM to a DEB
Sometimes the software you want to install is not available in the Ubuntu repo's and when you find it on the web you discover that "oh noes, it's only available as a Red Hat "rpm"
Never fear, it is usually possible to convert the rpm to a deb using alien. This should be done as a last resort however, it's always better to use a native deb package wherever possible.
The alien package is available from the multiverse repository. If you need to enable this repo see this post here
Install alien;
sudo apt-get install alien
To convert an rpm;
alien --to-deb --scripts package-xyz.rpm
As always, you should change package-xyz to the name of your package,
Never fear, it is usually possible to convert the rpm to a deb using alien. This should be done as a last resort however, it's always better to use a native deb package wherever possible.
The alien package is available from the multiverse repository. If you need to enable this repo see this post here
Install alien;
sudo apt-get install alien
To convert an rpm;
alien --to-deb --scripts package-xyz.rpm
As always, you should change package-xyz to the name of your package,
Thursday, 26 June 2008
Adding repositories
Ubuntu ships pre-configured to connect to the standard repositories.
A lot of extra packages are available from the "universe" and "multiverse" repositories.
You can add these by editing the file /etc/apt/sources.list (backup the original file first!)
gksu cp /etc/apt/sources.list /etc/apt/sources.list.bak
gksu gedit /etc/apt/sources.list
The sources.list file can look a bit daunting to the novice. Essentially there are four "sections" in each repository, they are;
hardy
hardy-updates
hardy-backports
hardy-security
Note: If you are using another release, replace "hardy" with the name of your release.
There are also four primary repositories;
main
restricted
universe
multiverse
The default sources.list file uses a seperate line for each repository and section. Most of the extra lines you require are already included but are commented out. You can uncomment them by removing the # from the beginning of each line that starts with "deb"
It is also possible to neaten things up by just adding all the repositories to a single set of four lines and simply removing everything else from the file (assuming you did the backup above!)
A simple sources.list using the repository at the main ubuntu site (http://archive.ubuntu.com) would be;
deb http://archive.ubuntu.com/ubuntu/ hardy main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu/ hardy-updates main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu/ hardy-backports main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu/ hardy-security main restricted universe multiverse
After you have made the changes and saved the file you need to tell the system to update the repository information;
sudo apt-get update
Now you have access to a whole lotta extra software goodness!
A lot of extra packages are available from the "universe" and "multiverse" repositories.
You can add these by editing the file /etc/apt/sources.list (backup the original file first!)
gksu cp /etc/apt/sources.list /etc/apt/sources.list.bak
gksu gedit /etc/apt/sources.list
The sources.list file can look a bit daunting to the novice. Essentially there are four "sections" in each repository, they are;
hardy
hardy-updates
hardy-backports
hardy-security
Note: If you are using another release, replace "hardy" with the name of your release.
There are also four primary repositories;
main
restricted
universe
multiverse
The default sources.list file uses a seperate line for each repository and section. Most of the extra lines you require are already included but are commented out. You can uncomment them by removing the # from the beginning of each line that starts with "deb"
It is also possible to neaten things up by just adding all the repositories to a single set of four lines and simply removing everything else from the file (assuming you did the backup above!)
A simple sources.list using the repository at the main ubuntu site (http://archive.ubuntu.com) would be;
deb http://archive.ubuntu.com/ubuntu/ hardy main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu/ hardy-updates main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu/ hardy-backports main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu/ hardy-security main restricted universe multiverse
After you have made the changes and saved the file you need to tell the system to update the repository information;
sudo apt-get update
Now you have access to a whole lotta extra software goodness!
Subscribe to:
Posts (Atom)