Posts Tagged ‘backup’

Ubuntu IRC- Please review/correct this script

November 25, 2009

If you are curious to visit the IRC channel, visit here first

Thanks for visiting from IRC #ubuntu-offtopic

I am a beginner with Linux Ubuntu, and I want a simple means
to back up my system occasionally.

I found a tar command at the following link:

I tried it once and it seemed to work, except I had some trouble getting rights to access the file in / root. I THINK that the following commands will work for me without hurting my install.

I DID do some things with sudo Nautilus and a /var/Backup folder which I believe crashed my whole Ubuntu system, and I had to spend 7 hours re-installing it, which you may read about at this blog.

So, I really need someone who is experienced in Linux and script/bash commands to look at this and tell me if there is any danger.

I DID get the tar command which you see below to work once, and I managed to copy it to a DVD. I put the dvd in my second computer which is a Wubi Ubuntu install on top of windows, and it was able to open the tar, browse the folders, and extract some files from /Desktop.


Thanks for looking and commenting!


sudo su

tar cvpzf backup.tgz –exclude=/proc –exclude=/lost+found –exclude=/backup.tgz –exclude=/mnt –exclude=/sys –exclude=/media /

sudo cd /

sudo chmod 777 backup.tgz

sudo cp -p backup.tgz /home/bryan/Desktop/mytestfolder/


>>> sudo rm /backup.tgz

Thanks for looking and commenting!


### sudo su
### This is silly for two reasons. First, ‘sudo -i’ is preferable to ‘sudo su’. Second, rather than putting sudo on every line of the script, just run the script itself with sudo.

# This will work, but using v (verbose) doesn’t really add value with this huge of a data set, and significantly impairs performance (the terminal can’t keep up), so I’d probably drop it.
tar cvpzf backup.tgz –exclude=/proc –exclude=/lost+found –exclude=/backup.tgz –exclude=/mnt –exclude=/sys –exclude=/media /
# Note that you are not specifying a target directory for backup.tgz to end up in here. As you’ve noticed, it’s helpful to have it somewhere that you’re not backing up, to avoid recursion.

sudo cd /

sudo chmod 777 backup.tgz

sudo cp -p backup.tgz /home/bryan/Desktop/mytestfolder/


THUS, my recommendations:
tar cpzf /backup.tgz –exclude=/proc –exclude=/lost+found –exclude=/backup.tgz –exclude=/mnt –exclude=/sys –exclude=/media /
chmod 755 /backup.tgz
ln -s /backup.tgz /home/bryan/Desktop/mytestfolder/
Save as
chmod +x
Run with:
sudo ./


tonyyarusso: one quick question, what does this last line do — ln -s /backup.tgz /home/bryan/Desktop/mytestfolder/
[02:07] what is ln -s
[02:07] WilliamBuell: Create a symbolic link
[02:07] WilliamBuell: it creates a symbolic link
[02:07] symlink
[02:08] WilliamBuell: It makes a “pointer” of sorts in your home directory to the real file, rather than copying it all over.
[02:08] and, ok ln symbolic link, how is that useful
[02:08] can reach data 2 ways but only have it exist on disk once
[02:08] so, you are saying that when I mount a dvd, and go to file manager, i will SEE the tar in that folder (but it is really the symbolic link) and i may freely copy it to the dvd
[02:08] so if you dont want to type a really really long path, you can have a shortcut
[02:08] WilliamBuell: Half the disk space usage, and less time.
[02:08] WilliamBuell: yup
[02:09] wow, thanks, now it all makes sense
[02:09] there are also hardlinks (ln without the -s)
[02:09] what is difference between hard and soft link
[02:09] symlinks point to a path to the data so they can point to things on other disks/partitions/media

hardlink vs symlink

[02:19] WilliamBuell: I thought you wanted it in that folder for some kind of convenience – it’s certainly not necessary.
[02:19] oh, ok…. i am just scared to death of root, since my crash
[02:19] the script can go wherever you like. Many people like to create /home/bryan/bin/ for such things, but it doesn’t matter.
[02:20] so sudo ./ WILL SEARCH until it finds that file, wherever it is, even on /Desktop ?
[02:20] No.
[02:20] It will be the current working directory, whatever that is.
[02:21] oh, ok, so as long as i am in current directory where that .sh is, and i sudo ./ it will find the .sh
[02:21] but, i should not save the script to root, i take it
[02:22] and if i did create /home/bryan/bin i would cd to that, and then sudo ./
[02:23] right
[02:23] but, if i went into gedit and saved some file as in root,… it would not harm root
[02:23] except it is a bad practice to store things in root



November 23, 2009

So I have to start from scratch!

I was trying two different methods of BACKUP for Ubuntu.

One was a humungous tar command which allegedly zips the entire system into a 1.6 gig tar file.

The other was something called simple backup which installed through synaptic manager.

The simple backup ran and created a folder /var/backup that could not be accessed without root privileges.

I could swear that I blogged elaborate notes about the tar backkup, but somehow that tar file winds up in root, and cannot be accessed except with admin root rights.

So, someone suggested that I issue in terminal

sudo nautilus

which would launch me into the file manager with super rights.

I got some error messages, but it did put me into file manager with rights, and it allowed me to delete that /backup.tar.gz file.

But when I rebooted, then I was getting this error:


I searched for some way to boot into a rescue mode, but nothing worked.

So, I am starting all over, first with the Gnome partition program, except THIS TIME I am making root 10000 instead of 5000. I am leaving the swap-file partition at 5000 like the first time. I feel that I need a larger root.

Now, I keep re-running the ubuntu install and it keeps hanging. It may help now that I hit F4 and used the SAFE GRAPHICS MODE.

IF and when I get a fresh Ubuntu install, then I have the option to try and unzip that one tar backup which I have. On the one hand, it is taking me so long to do the install, that I am afraid that the tar restore will not work, and I will be back at the beginning. On the other hand, when will I ever try the tar unzip restore to know that it is reliable?

For some reason, the Ubuntu install keeps dying, hanging. So, I went back into the Gnome partition software and tried making everything ext4 format instead of ext3. And I made /home half the size and added a 4th partititon called /extra.

Might as well experiment with different things.

Suddenly, Ubuntu is coming right up! I guess it likes ext4 better than ext3!?

ubuntu install manual pdf ext4

Here are some odd differences from my first experience:

As the install began, I plugged in my Belkin USB WiFi adapter, and Ubuntu INSTANTLY recognized it without having to bother with ndiswrapper!

As the install advanced, it showed me the partitions I created with Gnome Partition Manager, and then said THERE IS NO OPERATING SYSTEM DO YOU WANT TO USE THE ENTIRE DISK. So, I said yes, and I guess it is creating its own root and swap.

It occurs to me that I do not DARE try that old tar file restore, for the simple reason that the previous install was NOT ext4.

So if I do anything at all, it should be to immediately try a complete backup and then a restore right now with the tar method.

I do think the install goes better if I press F4 and choose the safe monitor mode.

During my first install, I wasted tons of time on various problems.

I did not realize that I had an obsolete mouse that did not function correctly, so that made things difficult during the initial partitioning and installation.

I spent tons of time trying to make ethernet cable work, but now I know that it is best for me to stick with WiFi.

And I spent a lot of time in vain trying to use ndiswrapper for the Belkin, when it is recognized automatically.

This time around, I did something a little different when the install finished. Instead of clicking on REBOOT, I clicked on CONTINUE TESTING which simply means that I can go to update manager, and install some things, which seems to make more sense then immediately rebooting.

The Update Manager said I was up to date but when I clicked on SEARCH for updates, it found many, and is installing them now.

I do notice that there is an error message to the effect that some of the drive is not formatted. I may take courage and try to correct that now. Once a week or two of work has gone by, I wont have the courage to possibly make a mistake. But if I am going to address the problem/question, now is the time.

Oddly enough, when I removed the install disc, shut down, and then rebooted from the hard drive, the Belkin WiFi was not recognized until I unplugged it and then plugged it back in, and then I had to reenter the WEP key.

I am redoing the UPDATE downloads. They had some trouble when I was in the CONTINUE TESTING mode. And the SHUTDOWN icon that I added to the launch pad was not there when I rebooted.

My UPDATES just now finished ok. The very next thing I will do is add TERMINAL to the launch pad, and enter the command

sudo tasksel

arrow down to highlight LAMP (Linux Apache MySQL PhP)


AND THEN tab down to and press enter.

This is the easiest and most straight-forward way to get MySQL database engine, Apache webserver, and PhP dynamic HTML to interact with the SQL database.

It prompts me for the password for the MySQL user and then verifies the password. Next I will go to synaptic manager and install phpmyadmin. I key in phpmy in the search field and it jumps right to phpmyadmin. I mark it for install. During the install it asks me if I want apache2 (which I do) or lighttpd (which I DO NOT).

Next, in Firefox, I key in localhost/phpmyadmin

It prompts me for the user which this first time should be root, and the password.

Now that you are in as Admin, you must add your own user name (I use bryan in honor of my step-son) and give all possible rights.
So, click on PRIVILEGES and go down to ADD NEW USER.
I leave the default of ANY HOST, I click on CHECK ALL for privileges

and I check CREATE DATABASE WITH SAME NAME AND GRANT ALL PRIVILEGES. After all, I can always go back and add a different user name, with different privileges if need be.

I add GEDIT to the launch pad, and paste and save the SQL code generated to create the new user and save it to the desktop.

Then, I exit from phpmyadmin by going to the little icons in the upper left which are hard to see, and clicking on EXIT.

Next, I want to set up Evolution email and add my two Gmail accounts.

I notice that the first thing Evolution offers to me is an opportunity to restore from a backup file. I should have made such a backup. But I will in the future.

In order to set up the two Gmail accounts, I had to experiment quit a bit to guess at the proper settings.

Whenever you launch EVOLUTION email client in Ubuntu, you may click on Edit-> Preferences and see the various email accounts that you are attached to.


For a Gmail account, in the RECEIVING EMAIL, you want to specify
Username: (whatever your email user name like superman or wonderwoman if you prefer i.e. whatever name you chose to go in your address like but leave out the part for this field and just enter the NAME)

Use secure connection: SSL encryption
Authentication type: PASSWORD

and you may experiment with checking the REMEMBER ME box to see which you might prefer.

The SENDING EMAIL is configured as follows for Gmail:

Server type: SMPT
Beneath this option check the box for SERVER AUTHENTICATION REQUIRED.


Use Secure Connection: SSL encryption

Type: Login

And you may experiment with checking and unchecking the REMEMBER PASSWORD box to see what suits your need.

Username: (here you put your user name as above – e.g. superman, wonderwoman)

NOW I test out my first gmail by sending a message to my second gmail that I am about to add.

I will be prompted twice for the password, once to receive mail, and once to send.

Then I click on EDIT and Preferences to ADD A SECOND GMAIL ACCOUNT.

The first time it took me an hour or two to figure out the correct email settings. It is very fortunate that I took the time to write everything down.

Next, I want to go to the synaptic manager and install Konversation for IRC chat in the Ubuntu forum.

I have already registered my name there as WilliamBuell.

During this second install, I found it handy to refer to to see some of the many bookmarks I have saved.

The install time for all these packages adds up to a lot of time, in addition to the efforts to configure them, and everything depends upon these elaborate notes.

Once the install is done, I go to APPLICATIONS, INTERNET and I will see Konversation there. I right click on it and add it to the Launch pad which is the bar accross the top of my desktop.

I click on Konversation and click EDIT, and then next to IDENTITY where it says DEFAULT IDENTITY I click EDIT. I remove any names that might be there and put WilliamBuell

at the bottom under service I put nickserv and then I enter my password. NOTE one has to have registered a name with nickserv before this will work.
I click on Away and Advanced and place my wordpress url in the part and quit messages, but I dont know if that will work or if it is permitted.

Now that Konversation is set up, I will install EMPATHY, the chat client for AIM, MSN, ICQ, Yahoo, etc.

I say YES I want to enter my new account details NOW, and click FORWARD.

First I add my two gmail accounts
williambuell and literarydiscussions
, and at the bottom, make certain that YES I WANT TO ADD MORE is clicked.

Next I add my AOL chat identity literarytalks
Then I add MSN
Next, ICQ
and finally Yahoo literarydiscussions

Well I guess I have restored enough of Ubuntu for today since it is almost 7:00 am

Just before I went to sleep, I stumbled across an Ubuntu forum in India, so I joined and posted a link to this blog

Ubuntu Backup/Restore Plans

November 22, 2009

Konversation IRC chat client, every day I am in Kubuntu chat with 300 members active at any time (well logged in but not necessarily all talking)

I need to study/experiment with complete backup restore techniques

someone gave me this advice

for the mem stick, just mount it (i.e. on /mnt/bckstick) then tar f /mnt/bckstick/.tar

I must google and expand upon it

Today I do sweeping and mopping, but I shall add to this post, and

I also used synaptic manager to install a simply gui backup restore and i shall test that also, but a huge tar command is attractive to me.

In Kubuntu IRC (Konversation is my client) one may query bot with !
and !info

!info backup gave several links

The most useful looking link is