./ Index     / Howtos     / Tweaks     / Themes     / Apps     / CLI Tricks     / Hacking     / Cracking     / Customization     
Showing posts with label Backup. Show all posts
Showing posts with label Backup. Show all posts

Introducing FlyBack v0.5.0 svn - Apple's Time Machine for Linux Snapshot-based backup Solution based on rsync!


Did you ever try Apple's Time Machine for OSX? Well if you have and you like it, and switched from Apple to Linux you will want to give this nice little application a try, this application is currently being developed here at Google Code


How Does FlyBack work?

FlyBack is a snapshot-based backup tool based on rsync It creates successive backup directories mirroring the files you wish to backup, but hard-links unchanged files to the previous backup. This prevents wasting disk space while providing you with full access to all your files without any sort of recovery program. If your machine crashes, just move your external drive to your new machine and copy the latest backup using whatever file browser you normally use.

Note that this means you can selectively delete specific backups and still retain files stored in previous ones. (ie., you can delete tuesday's backup and keep monday's, without screwing up wednesday's)

Ways FlyBack Differs from Time Machine

1. There is no inotify mechanism in Linux, so FlyBack scans your entire directory structure when performing a backup.
2. No hard-linking

This morning I created a install package for everyone running gnome, it should work, let me know if you have any issues.

Lets get to installing shall we?

Click Here to install the necessary packages with apt-url or via Applications->Accessories->Terminal:
sudo apt-get install python python-glade2 python-gnome2 python-sqlite3 rsync python-pysqlite2

Click Here to download flyback to your desktop or any directory

Right Click on flyback.tar.gz and select "Extract Here.."

Once extracted enter the flyback directory

To Install double click install and select run, enter sudo password then click ok twice

To Uninstall double click uninstall and select run, enter sudo password then click ok twice

The slideshow is an good example of these steps.

Y can access Flyback via Applications->System Tools->flyback
-

(optional)Alternate svn install:

Make sure you have the following packages installed for your correct distro:

Debian:
sudo apt-get install python python-glade2 python-gnome2 python-sqlite3 rsync
Ubuntu:
sudo apt-get install python python-glade2 python-gnome2 python-sqlite3 python-gconf rsync
Redhat/Fedora:
yum install pygtk2 gnome-python2-gconf pygtk2-libglade python-sqlite3

Then download via svn you will need to:
sudo apt-get install subversion
svn checkout http://flyback.googlecode.com/svn/trunk/ flyback
cd flyback/src
To Run:
python flyback.py

Expand full post here...

Comments

Howto: Create Split .Rar Files in Ubuntu Linux for archiving, filesharing, and backup purposes.

If you need to compress a large part of your hard drive to backup on a filesharing site or backup something larger than a cd/dvd you can use rar to split the file/files into multiple parts, you often see rar files on warez, torrents, and ftp's, here are the directions on creating these files and extracting them.

Lets grab the rar program:
sudo apt-get install rar
Ok lets compress our directory of files:

To compress file(s) to split rar archive know which directory you want to compress, I used /home as an example

rar a -m5 -v5M -R myarchive /home/

Let me break the above command down

rar - starts the program
a - tells program to add files to the archive
-m5 - determine the compression level (0-store (fast)...3-default...5-maximum(slow))
-v5M - determine the size of each file in split archive, in this example you get files with size 5MB (if you wanted files of 512kB size you would write -v512k)
myarchive - name of the archive you are creating
/home/ - is folder of the files you wish to add to the archive

You can read the manual for more options:
man rar
Press q to exit and arrows to scroll up/down
You can also add -p to the command after a and it will prompt you for a password.

To uncompress the archive type:

rar x myarchive.part01.rar


Or right click on file myarchive.part01.rar and choose Extract Here.

Expand full post here...

Comments

Easily Setup Seperate /home partition in Ubuntu!

Ok I have almost always had a seperate home partition, excluding the 3-10 times I have completely crashed my system and had to redo it all.

Reasons you should use a seperate home partition:
1. Easy backup/restore.
2. You can simply rm -rf / and pop in a livecd and be able to mount your home partition as /home without deleting users home directories and files.
3. You can use multiple linux Distro's with the /home partition
4. You dont have to worrie about the hassle of re-installing or upgrading ubuntu because everything you need is in your /home directory, you can simply backup all your apt packages via aptoncd.

Howto:
1. Reboot/Boot up your ubuntu live cd.
2. sudo aptitude update && sudo aptitude install gparted ntfsprogs
3. Then, press Alt-F2 and type:
gksudo gparted
4. In GParted, find the partition you want to resize in order to make room for your upcoming /home partition. In this case, I'm resizing /dev/hda5, but your partition may be different. Be sure to keep track of the names of your partitions--these names are very important (/dev/hda1, /dev/hdb1, /dev/sda2, etc.).
5. Right-click on the partition and choose the Resize/Move option.
6. Choose the new size you want.
7. Then, in the new empty space, right-click and select New.
8. Choose to create the partition as Filesystem ext3.
9. When you're satisfied with your new partition layout, click Apply
Once the changes have been applied, make note of the partition name of your new partition and then quit GParted.

Now, my original partition that I shrunk was /dev/hda5, and it created a new partition called /dev/hda7, and my /home folder lives on /dev/hda1. It's very important that you substitute in your own appropriate partition names for the ones I'm using--you most likely will have only two partitions you're dealing with--the one you shrunk and the newly created one.
Ok sweet now that is done, all we gotta do now is setup the new partition to be used...
Now, back in the terminal, I'm going to mount /dev/hda1 and /dev/hda7:

sudo mkdir /old
sudo mount -t ext3 /dev/hda1 /old
sudo mkdir /new
sudo mount -t ext3 /dev/hda7 /new

Now we're going to back up the /home directory on the old partition and move it to the new partition:
cd /old/home
find . -depth -print0 | sudo cpio --null --sparse -pvd /new/
sudo mv /old/home /old/home_backup
sudo mkdir /old/home

Yes, one of those lines looks really complicated--please type it as is--or, if you're unsure of your typing skills, copy and paste it into the terminal. Believe me--the command is necessary.

Next, we're going to specify to use the new home partition as /home:
sudo cp /old/etc/fstab /old/etc/fstab_backup

type blkid in terminal and find /dev/hda7 it will look something like this:
/dev/hda7/: UUID="8b89a5c4-20ff-477c-a49e-c1ccb435bf11" SEC_TYPE="ext2" TYPE="ext3"

Copy the "UUID=8b89a5c4-20ff-477c-a49e-c1ccb435bf11"
sudo nano /old/etc/fstab

You'll then be taken to the nano text editor. Add in these lines:
# /dev/hda7
UUID=8b89a5c4-20ff-477c-a49e-c1ccb435bf11 /home ext3
defaults,noatime,errors=remount-ro
Then save (Control-X), confirm (Y), and exit (Enter)

After you reboot, you should be now using your new /home partition.

If you find that you are running out of room on your old partition and you're pretty confident everything is working as it should be, then go ahead and delete the backup of home:
sudo rm -rf /home_backup

What if this doesn't work?
You know, it really should work, but if you somehow messed up your /etc/fstab and didn't configure it correctly... well, that's why we have a live CD, so we can fix things.

Boot up the live CD, go to a terminal, and type:
sudo mkdir /recovery
sudo mount -t ext3 /dev/hda1 /recovery
sudo cp -R /recovery/home_backup /recovery/home
sudo cp /recovery/etc/fstab_backup /recovery/etc/fstab

Expand full post here...

Comments

Remaster And Clone your Ubuntu Install to a live cd

Remastersys will 'remaster' your existing Ubuntu based distro into a live cd/DVD. Tools like PCLinuxOS's mklivecd have been around a while and proved to be very popular but are tricky to get working with the newer releases of debian/ubuntu, so some guy (apologies, forgot your name) over at Linux Mint (an ubuntu-based distribution) made this really cool tool. And although it has only really been in popular use since about March this year, it has already been compared to the maturity of mklivecd.
Install:
Add the Linux Mint repo to your /etc/apt/sources.list
echo "deb http://www.linuxmint.com/repository romeo/" >>/etc/apt/sources.list
do a "sudo apt-get update"
then:
"sudo apt-get install remastersys" and it should install fine.

Then simply type "sudo remastersys" to get the list of options, which include:
backup - backs up your system including your /home folder with your users on it.

dist - omits the /home folder thus making it a distributable cd that you can give to your friends.

clean - removes the temporary folder that was created, including the new iso so burn it and copy it elsewhere before you run "sudo remastersys clean"

Expand full post here...

Comments

Howto: Free Encrypted Online Storage for Ubuntu

For quite a while now I was looking for a solution, to store a backup of my boot partition (ubuntu server) online, since it took me about half a year to get the system configured the way I wanted it. Loosing it would definitely cause an attempted genocide. But I had two major concerns:
1: The costs. Why would I have to pay for something, that is already available in different forms. Yeah, services like S3 from amazon are affordable, but, why pay when you don't have to, right?
2: Security. I'm aware of the fact that there is no such thing as total security when you're somehow connected to the interwebs, but I don't wanna trust some firm, where I can't hunt down the sysadmin with a baseball bat, because he got into my backup files. I think you get the point.

So here is what I did.

Create a backup with tar, split it into 94MB files, encrypt them with my gpg key and upload them to rapidshare. Rapidshare will delete the files after 3 month, if you haven't accessed them, which sould be quite enough.

Let's have a look at the full backup script:

Code:

#!/bin/bash
#create directory for this month full back in /home/saylar/backup/
mkdir /home/saylar/backup/`date '+%Y-%m'`
mkdir /home/saylar/backup/`date '+%Y-%m'`/full_backup/
#create a full backup for this month and split it into 94MB Files
tar cvj --listed-incremental /home/saylar/backup/`date '+%Y-%m'`/fullbackup.snar --exclude=/proc --exclude=/lost+found --exclude=/mnt --exclude=/sys --exclude=/home/saylar/backup / | split -d -b 90m - /home/saylar/backup/`date '+%Y-%m'`/full_backup/full_backup.tar.bz2.split
#encrypt the files with gpg
gpg --encrypt-files --batch --no-tty -r dummy@email.address /home/saylar/backup/`date '+%Y-%m'`/full_backup/*split*
#upload the files via rsupload script
for gpg in /home/saylar/backup/`date '+%Y-%m'`/full_backup/*gpg;
do /home/saylar/backup/rsupload.pl "$gpg";
done
#now move the file with Rapidsharelinks into corresponding directory
mv /home/saylar/backup/rsulres.txt /home/saylar/backup/`date '+%Y-%m'`/full_backup/
#delete gpg files after they were succesfully uploaded
rm -r /home/saylar/backup/`date '+%Y-%m'`/full_backup/*gpg

As you can see, it first creates a directory in /home/saylar/backup for this month and a full_backup directory. Then we tar the whole filesystem and pipe that into the split command which will split the files into 94MB files. Then we encrypt the split files with gpg. Note the --batch --tty option. This is neccessary because the script is started by cron, otherwise it won't run. Then we take upload script provided by rapidshare(Look for the news from 22. Dec. 2006) and upload the gpg files. Since the script does a MD5 check, there is no need to worry about corrupted files. Now we just have to move the file with the download links into the corresponding backup directory and remove the gpg files again. The scripts are running at 6am each day and at 11:30 pm each day we'll move the logfiles of what was done into the corresponding directory. Just to be sure, that the fullbackup is really finished.

So, if you wanna do that, you have to do the following things:
Code:

mkdir ~/backup
Code:

mkdir ~/backup/log
Put the attached files into the backup directory and replace saylar in every script with you username, replace dummy@email.address with the email address you create the gpg keys for and make them executable with:
Code:

chmod a+x scriptname
Also look into rsupload.pl, there is one entry at the end of the file. Afterwards edit the crontab for root
Code:

sudo crontab -e
and put the following there:
Code:

0 6 1 * * /home/saylar/backup/backup_full >> /home/saylar/backup/log/backup_full.log 2>&1
0 6 8,15,23,30 * * /home/saylar/backup/backup_incr_weekly >> /home/saylar/backup/log/backup_incr_weekly.log 2>&1
0 6 2,3,4,5,6,7,9,10,11,12,13,14,16,17,18,19,20,21,22,24,25,26,27,28,29,31 * * /home/saylar/backup/backup_incr_daily >> /home/saylar/backup/log/backup_incr_daily.log 2>&1
30 23 * * * /home/saylar/backup/mvlog > /dev/null

Again, make sure you change the username and you are set for a secure backup stored online.

PS: I'm no programmer at all, so I know that some things could be done much nicer, but it works very well for me. If you have any suggestions, let me you know and I'll be happy to change it.

Sources:
Howto: Backup and restore your system!
Rapidshare Upload Script
GPG Tutorial

Download Backup script Here

Expand full post here...

Comments

Howto: Customize your own Ubuntu Live CD

This will work for Feisty, and for Gutsy too.

This tutorial is actually based on a bash script. I figured typing commands line by line is far to slow, and mistakes can be made. A script simplifies the operation, and can be modified to taste.

I will first provide a basic script that everyone should find useful. The script can be further modified by simply adding lines of code where necessary.

Here's how you do it:

1 - What you need:
Create a new folder called: live
Download the 7.04 (Feisty) desktop iso and place in the live folder.
Download the Flash browser plugin from Adobe: http://fpdownload.macromedia.com/get...9_linux.tar.gz
Extract the flashplayer.xpt and the libflashplayer.so files and place in the live folder.
You will also need to install a couple of tools onto your computer to make this whole thing possible:

Code:

sudo apt-get install squashfs-tools mkisofs
These only need to be installed the once, and so don't need to be part of the script.

2 - The basic script:

Code:

#!/bin/bash

ubuntuiso=ubuntu-7.04-desktop-i386.iso
customiso=ubuntu-7.04-H12Y-v1.iso
kernel=2.6.20-15-generic

clear
echo Customize Ubuntu LiveCD
echo
echo Script by: Stephen Clark
echo Based on documentation found at:
echo https://help.ubuntu.com/community/LiveCDCustomization
echo
echo "For customizing Ubuntu 7.04 (Feisty Fawn)"
echo
echo Press Ctrl C at any time to quit
echo

echo -n "Loading squashfs module... "
modprobe squashfs
echo Done
echo

echo -n "Extract iso contents? y/[n] "
read ua
if [ "$ua" = "y" ]; then
if [ -e "edit" ]; then
echo -n "Removing existing Desktop System... "
rm -r edit
echo Done
fi
mkdir edit
if [ -e "extract-cd" ]; then
echo -n "Removing existing CD contents... "
rm -r extract-cd
echo Done
fi
mkdir extract-cd
if ! [ -e "mnt" ]; then
mkdir mnt
fi
if ! [ -e "squashfs" ]; then
mkdir squashfs
fi
echo -n "Extracting CD contents... "
mount -o loop $ubuntuiso mnt
rsync --exclude=/casper/filesystem.squashfs -a mnt/ extract-cd
echo Done
echo -n "Extracting Desktop System... "
mount -t squashfs -o loop mnt/casper/filesystem.squashfs squashfs
cp -a squashfs/* edit/
umount squashfs
umount mnt
echo Done
fi
echo

# Place custom scripting here

# Initialize networking and sources

cp /etc/resolv.conf edit/etc
cp /etc/hosts edit/etc
cp /etc/apt/sources.list edit/etc/apt

echo -n "Start package removal? y/[n] "
read ua
if [ "$ua" = "y" ]; then
echo
# Not all apps can be purged without dependency problems
# Accept whatever solution aptitude offers
chroot edit apt-get remove --purge ekiga evolution tomboy serpentine f-spot gnome-games bittorrent onboard gnome-pilot gnome-pilot-conduits libpisock9 libpisync0
fi
echo

echo -n "Start package installation? y/[n] "
read ua
if [ "$ua" = "y" ]; then
echo
# -q supresses the output to a minimum
chroot edit apt-get update -qq
# sox, vorbis-tools, & mpg123-alsa are for previewing sound files in nautilus
# The gstreamer packages are for codec support
chroot edit apt-get install mozilla-thunderbird sox vorbis-tools mpg123-alsa vlc comixcursors gnome-themes-extras gstreamer0.10-plugins-bad-multiverse gstreamer0.10-plugins-ugly gstreamer0.10-ffmpeg gstreamer0.10-plugins-bad
chroot edit apt-get clean
fi
echo

echo -n "Installing Flash plugin for Firefox... "
# Install flash plugins
cp flashplayer.xpt edit/usr/lib/firefox/plugins
cp libflashplayer.so edit/usr/lib/firefox/plugins
echo Done
echo

# Clean up

rm edit/etc/resolv.conf
rm edit/etc/hosts
rm edit/etc/apt/sources.list

if [ -e "extract-cd/programs" ]; then
echo -n "Remove unwanted Windows applications from LiveCD? [y]/n "
read ua
if ! [ "$ua" = "n" ]; then
echo -n "Removing Windows applications... "
rm -r extract-cd/programs
echo Done
fi
echo
fi

echo -n "Copying wallpaper... "
if [ -f "edit/usr/share/backgrounds/*.*" ]; then
rm edit/usr/share/backgrounds/*.*
fi
cp wallpaper/* edit/usr/share/backgrounds/
cp ubuntu-wallpapers.xml edit/usr/share/gnome-background-properties/
echo Done
echo

echo Setting gconf defaults for wallpaper, mouse, theme, nautilus and panel
# Wallpaper
chroot edit gconftool-2 --direct --config-source xml:readwrite:/etc/gconf/gconf.xml.defaults --type string --set /desktop/gnome/background/picture_filename "/usr/share/backgrounds/01.jpg"
# Mouse
chroot edit gconftool-2 --direct --config-source xml:readwrite:/etc/gconf/gconf.xml.defaults --type string --set /desktop/gnome/peripherals/mouse/cursor_theme "ComixCursors-Orange-Large-Slim"
# Theme
chroot edit gconftool-2 --direct --config-source xml:readwrite:/etc/gconf/gconf.xml.defaults --type string --set /desktop/gnome/interface/gtk_theme "Nuvola"
chroot edit gconftool-2 --direct --config-source xml:readwrite:/etc/gconf/gconf.xml.defaults --type string --set /desktop/gnome/interface/icon_theme "Nuvola"
chroot edit gconftool-2 --direct --config-source xml:readwrite:/etc/gconf/gconf.xml.defaults --type string --set /apps/metacity/general/theme "Nuvola"
# Nautilus
chroot edit gconftool-2 --direct --config-source xml:readwrite:/etc/gconf/gconf.xml.defaults --type string --set /apps/nautilus/preferences/click_policy "single"
chroot edit gconftool-2 --direct --config-source xml:readwrite:/etc/gconf/gconf.xml.defaults --type string --set /apps/nautilus/preferences/desktop_font "Sans Bold 10"
chroot edit gconftool-2 --direct --config-source xml:readwrite:/etc/gconf/gconf.xml.defaults --type bool --set /apps/nautilus/preferences/start_with_sidebar "false"
chroot edit gconftool-2 --direct --config-source xml:readwrite:/etc/gconf/gconf.xml.defaults --type bool --set /apps/nautilus/icon_view/default_use_tighter_layout "true"
echo

# End of custom scripting

# Putting the CD together

echo -n "Recompile iso? [y]/n "
read ua
if [ "$ua" = "n" ]; then
echo
echo The End
echo
exit
fi

echo Compressing filesystem
if [ -e "extract-cd/casper/filesystem.squashfs" ]; then
rm extract-cd/casper/filesystem.squashfs
fi
mksquashfs edit extract-cd/casper/filesystem.squashfs
echo

echo -n "Removing old md5sum.txt and calculating new md5 sums... "
rm extract-cd/md5sum.txt
(cd extract-cd && find . -type f -print0 | xargs -0 md5sum > md5sum.txt)
echo Done
echo

echo Creating iso
if [ -f "$customiso" ]; then
echo -n "Removing old custom iso... "
rm $customiso
echo Done
echo
fi
cd extract-cd
mkisofs -r -V "$IMAGE_NAME" -cache-inodes -J -l -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table -o ../$customiso .
echo

echo The End
echo

Open Gedit and paste this code in. Save file as: customize-livecd.sh and place in your live folder.
To run the script, open a terminal and type:
Code:

sudo sh ./customize-livecd.sh
The first time round, you will answer yes to all questions. After that, you can respond with no to save time extracting the iso again (unless you want to clean things up).

3 - A brief explanation:

The first thing the script does is to load the squashfs module. This is necessary for the extraction/compression process to work.
Then it asks whether to extract the iso contents. If you want to start a fresh customization, answer yes. Answering no will save time having to extract everything from the iso again.
There are 3 lines that copy your network settings and the sources.list to enable downloading of packages to the extracted iso.
Then follows package removal and installation. Again, you can answer no to save time if you have already done it. Adjust the packages to be removed or installed to taste.
Then your Flash plugin for Firefox will be copied over.
There are some Windows application on the LiveCD which don't serve much purpose, so they can be removed too making a bit of room.
The next section is for copying any wallpaper over. If you don't want this, delete these 7 lines. If you do, create a folder in the live folder called wallpaper. Copy any wallpaper you want into this folder. If you wish to have these show up in the Desktop Background applet, you can customize the ubuntu-wallpapers.xml and add them. You can find this file in /usr/share/gnome-background-properties/. Make a copy of the ubuntu-wallpapers.xml file into the live folder and alter this copy instead. This will have to be modified by hand using Gedit before running the script. It's quite obvious how to alter the xml file once you've opened it.
The next few lines are for modifying some settings that you can find using the Configuration Editor. It gives you an idea of how to create your own default settings. This can be extended to just about everything you find in the Configuration Editor including setting up a complete customized desktop and panel(s).
Now we come to the part where the whole thing will be put back together and create a new iso.
At the very beginning of the script, you will notice 3 variables. ubuntuiso is the name of the Ubuntu iso you downloaded. customiso is the name of the new iso you will create from this script. kernel is the kernel used in the iso you downloaded. If you're customizing Gutsy, it will be 2.6.22-7-generic.

4 - There are some laptop owners having problems booting the LiveCD due to driver problems. I personally own a Philips X56 which has this exact problem. So, for anyone with a Philips freevents X56, Twinhead H12Y, Avaretec 2460, or Everex Stepnote SA2050, this is the fix:
Download: http://www.fitzenreiter.de/averatec/...16-generic.tgz
Extract the 8139too.ko.2.6.20-16-generic file, copy it to the live folder and rename it to 8139too.ko . Add these few lines to the script:
Code:

# Patch for Twinhead H12Y notebooks

echo -n "Install patch for $kernel kernel? y/[n] "
read ua
if [ "$ua" = "y" ]; then
echo 8139too PIO from: http://www.fitzenreiter.de/averatec/index-e.htm
echo -n "Removing SDHCI and replacing 8139too MIMO to PIO... "
sdhci=edit/lib/modules/$kernel/kernel/drivers/mmc/host/sdhci.ko
too=edit/lib/modules/$kernel/kernel/drivers/net/8139too.ko
if [ -f "$sdhci" ]; then
rm $sdhci
fi
if [ -f "$too" ]; then
rm $too
fi
cp 8139too.ko $too
echo Done
echo
echo -n "Rebuilding initrd... "
chroot edit mkinitramfs -o /initrd.gz $kernel
mv edit/initrd.gz extract-cd/casper/
echo Done
fi
echo

... just before the line that reads: # End of custom scripting. Bear in mind that any updates to the kernel will also have to be patched. After installation, any new kernels can be patched using the patch you just download and extracted. Follow the instructions within.

That's about it.

Expand full post here...

Comments

Howto: Clone Ubuntu to different Computer Hardware

Hi! Welcome to a guide for cloning a Ubuntu software configuration to a computer with a different hardware configuration. I configured a Ubuntu operating system (Edgy Eft) with multiple testbeds and and a set of development software that worked well together, but to do this required a lot of time and energy. I needed to reproduce this configuration on a system with more memory and hard disk as time went on, so let me explain how I did it.

In order to clone a system to a different hardware platform, I used the same process, but had to make sure that I did not clone any hardware specific files or the new clone would probably not even boot. I looked at the Linux filesystem and the directories under / in Ubuntu and decided on the ones that I thought I would need to clone the software configuration and only tarred those. The directories I chose were: etc, home, opt, tmp, usr, and var. I also excluded the cloning tar file itself!

Step 1 - Preparing to Clone

Step 1A - Before you can clone your system, you will need to do a basic install of Ubuntu on the target machine. The version of Ubuntu must match the version of Ubuntu on the source machine that is being cloned. Make sure that you give this target computer a unique name on the network so samba can recognize it, then give it a unique initial user to prevent confusion.

Command Line Approach

Step 1B - To create shared folders via the Shared Folders menu, you type

Code:

shares-admin
into the command line, and the Shared Folders window appears. Click on Shared Folders, and the Install Sharing Services window will come up. Press install services, and provide the user password. You will get a message that the services have been installed properly and you can close the window. Before you do, you will want to add a share to your home directory. To do this, chose the '+Add' button on the top right of the form, and you will get a screen with the home directory share filled in for samba (smb) sharing. Click 'Okay' and the share will be set up.

GUI Approach


Step 1B - Once the system is installed on the hard disk, the CD removed, and the user logged on, then the share services need to be installed. To do this, go to the System tab at the top left and then the Administration menu, and finally the Shared Folders entry. Click on Shared Folders, and the Install Sharing Services window will come up. Press install services, and provide the user password. You will get a message that the services have been installed properly and you can close the window. Before you do, you will want to add a share to your home directory. To do this, chose the '+Add' button on the top right of the form, and you will get a screen with the home directory share filled in for samba (smb) sharing. Click 'Okay' and the share will be set up.

Step 1C - To prepare the source computer, you will want to remove any unneeded files, especially large ones because they will take longer to tar, transfer and untar and make the tar file that much bigger. Also, any personal data you don't want cloned to the target computer should be removed as well! The clone will look exactly like the source computer when we are finished.

Cloning

Now, we are ready to clone the source system and get it running on the target computer. In order to do this, we will need to make a tar file of certain directories, transfer this tar file to the target machine, and then un-tar it.

Step 2 - Creating the Tar File

Command Line Approach

To create the tar file, you will have to open up a terminal window. To do this, go to Applications > Accessories >Terminal and click. The terminal window starts out in your home directory. Let's assume you are in your home directory (~). In order to tar the directories we need, you will have to become root. To do this type in sudo -s. When prompted, enter your administrator account password, and you will be acting as root. The tar file will include the /etc, /home, /opt, /tmp, /usr, and /var directories and subdirectories, and the tar file itself needs to be kept from being included. So the command to tar the directories looks like this:

Code:

tar -cvzf ~/clone.tgz --exclude ~/clone.tgz /etc /home /opt /tmp /usr /var
The parts of the command are:

tar - the command itself

-cvzf - c means create, v means verbose, so the file names will appear on the screen as they are added, z means compress the file with gzip, f means the next argument is the name of the file to put the results in.

~/clone.tgz - this is the name of the file that will contain the tar results. ~/ indicates that the file will be created in the home directory.

--exclude - means that the tar file should not include the next file name

~/clone.tgz - so we are not including the tar file itself in the tar

/etc /home /opt /tmp /usr /var - these are the directories and their subdirectories that will be included in the tar file

The tar file, clone.tgz is now in your home directory, ready to be placed on the target computer. You can check this by entering

Code:

ls ~/clone.tgz
This will display the tar file name.

GUI Approach

To create the tar file using the GUI desktop, you will have to be logged in as root. To do this, go to System > Administration > Login Window. Enter admin password. Login Window Preferences window will open. Click on the Security tab. Check the Allow local system administrator login. Close the window. (I would recommend that after you create the tar file that you return to this window and un-check this option.)

Now you must switch to the root account. Go to System > Quit and chose Switch user in the window that appears. A login window will appear. Login in as root using the administrator password.

Next we are going to create the tar file. To do this, you must go to Applications > Accessories > Archive Manager. Click on the new icon. The new window will appear. Type in clone.tgz in the name field, the save in field will default to your home directory, and display the Archive type list, and select tar compressed with gzip, then click on the new icon.

A archive input window will appear. We will use this window to enter the directories we want as well as exclude clone.tar.gz itself.

Go to the edit tab, and select Add a folder by clicking on it. Double-click on File System under Places, and then locate and select 'etc'. Check the exclude symbolic link button. Click on the add button. Repeat for 'opt', 'tmp', 'usr', and 'var' and 'home'. When you are adding home, also exclude ~/clone.tar.gz before adding.

Once you are done, you can close the archive window. You have created the tar file clone.tar.gz in your home directory. You are now ready to place the tar file into the target computer.

Step 3 - Transferring the Tar File to the Target Computer

Command Line Approach

There are a number of ways to transfer the tar file to the target computer. I am going to use the 'netcat' method identified in BackupYourSystem/TAR.

To use netcat the target computer must be setup to receive the netcat transmission, and then the source computer can be used to send the transmission.

Step 3A - To setup the target computer to receive the transmission use the following command:

Code:

nc -l -p 1024 > ~/clone.tgz
The parts of the command are:

nc - the command itself

-l - means listen mode

-p - means the next parameter is the port to listen on
1024 - is the port to listen on

> - means create and direct the output to the file with the name that follows

~/clone.tgz - means copy the tar file into clone.tgz in the target machine's home directory

Step 3B - Next you send the tar file to the target computer from the source computer by using the following command

Code:

cat clone.tgz | nc -q 0 insert receiving host name or IP address 1024
The parts of the command are:

cat- reads the file (next parameter) and prints it to the standard output

clone.tgz - cat will read our tar file

| - pipe directs the output to the netcat command

nc - the command itself

-q - means quit after the EOF

0 - number of seconds of delay

1024 - is the port to listen on receiving host name or IP address - means create and direct the output to the file with the name that follows

~/clone.tgz - means copy the tar file into clone.tgz in the target machine's home directory

When the transfer is done, our file clone.tgz will be in the home directory of the target machine. Now it is time to un-tar the file.

GUI Approach

An easy approach to moving the files between machines is to setup shares and use samba to move the files. It is beyond the scope of this discussion to explain how to use samba, but there is good information about that elsewhere on the Internet. One such reference is http://www.oreilly.com/catalog/samba2/book/toc.html. Once samba is installed and ready to go (the basic installation of Edgy Eft Ubuntu all ready had samba up and running), go to Places > Connect to Server ... and the Connect to Server window will appear. Select the Windows share server type and then put in the name of the target computer's name (note it must be sharing out its home directory).

Select 'Connect' and an icon will appear on your desktop for the new share. Double click on the icon, and you will be prompted for the any connection information required. Once the 'Places' menu for this icon appears, you can open up a local home directory 'Places' window and just drag and drop the clone.tar.gz file from a Places window that shows the source computer's home directory to the Places window that shows the target computer's shared home directory.

You will be prompted for any other information the share needs to establish the connection (e.g., password). Once the connection is established, you will see a Places window showing what is in the share on the machine you connected to. When you connect to the target computer, you will see the home directory. Open another Places window on the source computer, and drag and drop the tar file from the source to the target computer's Places window. Depending on how large the files are, the copy could take several minutes.

Step 4 - Installing the Clone Files on the Target Computer


Command Line Approach

Installing the files on the target computer is very similar to creating them, The tar command is used again, only this time it is used to extract the files.

Code:

tar -xvpzf ~/clone.tgz -C /
The changes to the tar command for extracting the data are:

xvpzf - x means extract the files, v means verbose so the file names will appear on the screen as they are extracted, p means keep ownership the same as the original files, z means uncompress the files, and f means the next argument is the name of the file to put the results in.

~/clone.tgz - ~ means the home directory, clone.tgz is the tar file to extract

C - change directory to the one indicated next before extracting the files

/ - the root directory

Running the tar command to extract the files will take a little bit of time depending on how many and how big the files are.

GUI Approach

The same Archive Manager is used to extract the files as was used to create the files. Go to Applications > Accessories > Archive Manager, then open the clone.tar.gz file we just copied to the target computer's home directory. Select the Extract icon on the top row of icons.

Extract the files to 'File System' or '/'. This will put them in their proper place in the file system.

Step 5 - Completing the Install

Once the install is completed, the target computer needs to be restarted for the changes to take effect. The old user(s) you created when you first installed the basic Ubuntu configuration have been deleted, and the same users as existed on the source computer will now be the new users for the target computer. You will need to check the users and make sure that you only leave the users that you want to be on the new target machine. As well, you will need to change the name of the computer, because it will have the same name as the source computer, and if you are using samba or other network software, this will cause confusion.

Command Line Approach (Change host name)

The way to change the host name using the command line is as follows:

Code:

sudo gedit /etc/hostname
Once the file opens in the editor, you can rename the hostname. Avoid duplicates of host names already on the network.

GUI Approach (Change host name)

To change the host name using the GUI, go to the System menu > Administration > Networking > Network Settings, and on that page select the General tab. This will provide you with a text field to change the host name.

Some Things to Consider


One thing to consider is files that are not in the included folders (/etc, /home, /opt, /tmp, /usr, /var) or their sub-folders. For example, perhaps a backup file was added to one of root's folders. This file will not be cloned over, or any changes that were made to device files. Media files are not included, so any files that are related to the hardware, will still have to be configured if they weren't during the initial installation of Ubuntu. Also check for any updates as some of the files that were cloned may not be up to date. And most of all don't forget to tell your users, so they start using the new computer, and don't just continue to use the one they have gotten used to before.

In Closing

I tried not to repeat most of what was said in BackupYourSystem/TAR, but I did repeat what was needed so someone could clone their system and not have to read the other article to do it, since documents have a way of moving around on the Internet over time, and links become broken. There are many ways to do this, but this was the method I used, and it worked for me. It is not elegant, but it is simple and easy. I hope this detailed explanation does not turn off experienced users, but the newbie is more likely to use this article, and the more detail the better when you are starting out.

Expand full post here...

Comments

Howto: Backup apt .deb's for future Ubuntu Restore

Have you ever felt that there is no life without APT? Well, if you'd suddenly lost conection to the internet, how would you install new packages? What about dependencies? You've just finished installing Ubuntu and configured it to a rad look, with all your favorite applications? For some reason you now have to re-install it? Feel like you have to download all of your favorite programs again? What? You've already forgotten which packages you had dowloaded before?

Download Source
Download Ubuntu debain package
APTonCD is a tool with a graphical interface which allows you to create one or more CDs or DVDs (you choose the type of media) with all of the packages you've downloaded via APT-GET or APTITUDE, creating a removable repository that you can use on other computers.
APTonCD will also allow you to automatically create media with all of your .deb packages located in one especific repository, so that you can install them into your computers without the need for an internet conection.


With APTonCD you be able to...

Backup
Backup all downloaded packages (via apt-get, aptitude and synaptic) to restore later.
Transport
Take with you all your favorite packages, in a removable repository where you can install then all on anytime, anytime.
Download
Get an entire repository, or a specifc section. Simply point-and-click, and in few time you'll have an CD(s) or DVD(s) with entire main, restricted, universe, multiverse, contrib, etc.
Share
Share your packages with your friends without Internet conection. Also, send a meta-package for him to install the same set of packages that you have.


Expand full post here...

Comments