Linux upgrade in a few hours

If your work is organized in a way to have all documents inside /home partition and e-mails on remote server then you have qualities for easy upgrade to the new Linux desktop. Easy upgrade means to have a fully functional Linux desktop in a few hours. Is it installation or upgrade? Well, technically I will write about installation, but it will look like an upgrade.

  1. Qualities for easy upgrade
    1. Linux desktop partitions
    2. User documents
    3. E-mails, contacts, calendar, tasks …
    4. Browser settings (bookmark, history, plug-ins, add-ons …)
  2. Backup
  3. Upgrade with separate /home partition
  4. Upgrade without separate /home partition
  5. Conclusion

1.1 Linux desktop partitions
Linux Desktop should have at least a separate home partition. In this way /home partition will have the option to avoid formatting. Partitioning by the book for the Linux desktop with 80GB disk size can look like:

1GB  swap  # mark as primary
1GB  /     # mark as primary
1GB  /tmp  # mark as primary
67GB /home
8GB  /usr
2GB  /var 

1.2 User documents
It is good to have all documents inside one directory. If you running mini Web on your desktop, then you might have a problem. Why? Because default document root is /var/www/html and you will have to take care about it. Or you can – like I did – move /var/www/html to the Document directory and create symbolic link instead of html directory. You will have to allow read access and set FollowSymLinks to the document root. After I almost lost my mini Web, I decided to move it inside the home directory.

# 1) go to the /var/www directory
cd /var/www
# 2) move html to the Documents directory
mv html /home/user/Documents
# 3) create symbolic link to the html directory
ln -s /home/user/Documents/html html

1.3 E-mails, contacts, calendar, tasks …
It is not such a wisdom, let your e-mails remain on remote server and they should be safe and secured. In my company, Microsoft Exchange is selected as main collaborative software, so I use Exchange connector for Evolution. All e-mails, tasks, contacts and calendars are stored on Exchange server. After you install the Linux desktop, all you have to do is to create a new e-mail account in Evolution and you can continue the communication from the point before you made the last shut-down.

1.4 Browser settings (bookmark, history, plug-ins, add-ons …)
As a Web developer, browser with settings, add-ons, plug-ins, history, certificates is very important for me. I have local FireFox installation inside my home directory instead of using FireFox from the default RPM installation. Why?

  • easier and earlier FireFox upgrade (independent from RPM upgrade)
    In this way I have all rights to the binaries. FireFox just pops small popup like tooltip with new version announcement and after clicking on yes, newest FireFox is installed.
  • move browser settings and binaries together
    After starting FireFox in the new Linux installation, it should work and look like before. Version of the FireFox and its settings were preserved.

In the case of relocating FireFox, it is necessary to move two directories:

# inside .mozilla directory, FireFox saves history, bookmark, settings, plug-ins ...
# local FireFox installation

2. Backup
Make backup and be sure that backup is not corrupted. Don’t be lazy, at least you can make tar and scp to the other computer. If something goes wrong, this small step will save you!

3. Upgrade with separate /home partition
Before last shutdown, login as root user – don’t su, you have to logout from your user account. Why? Because session files should be properly closed. As root user, cd to the /home and rename existing user directory.

# 1) go to the /home directory
cd /home
# 2) rename user directory to the user_old
mv user user_old

This step will allow you to create the same user name in the new Linux installation. Now you can do shutdown and begin fresh Linux installation. After you choose language and keyboard layout you will come to the partition point. Please be careful and choose “custom partitioning”. You will have to remap existing partitions to the mount points. This is easy, because old mount points are saved as partition labels, and you can choose each partition and assign the same mount point. Very important: Do not mark /home partition for formatting. This partition should stay intact. Remember, /home partition contains all your data and environment in user_old directory. Other partitions should be formatted. This is the trick. Everything else goes as normal installation. Choose packages, create the same user as before, pick the time zone and finish the installation. Log in to the new Linux desktop and ls /home directory.

ls -1 /home
user     # new user data
user_old # old user data

Inside /home you should have two directories and you can return documents and FireFox preferences easily. Please start terminal and execute few commands:

# 1) delete /home/user/Documents (careful, /home/user/Documents should be empty)
rm /home/user/Documents
# 2) return documents from user_old
mv /home/user_old/Documents /home/user
# 3) return bookmark, history, add-ons, plug-ins, settings
mv /home/user_old/.mozilla /home/user
# 4) return FireFox binaries
mv /home/user_old/firefox /home/user

The point is that you have data and environment saved in /home/user_old directory and you can make easy restore to the /home/user. I will not recommend to return all dot files because you have new Linux version. Old dot files can confuse newer program versions. Yes, I tried to return some dot files and this caused more problems than applying few settings. FireFox and .mozilla are exception because dot file and binaries are returned together.

4. Upgrade without separate /home partition
In case without separate /home partition, you will have normal installation. Linux partition must be formatted because newer Linux will be installed. After installation is finished, unpack your backup. Unpack location can be anywhere, just don’t overwrite your existing /home/user directory. From this point, you can move parts from unpacked backup like described in the previous chapter.

5. Conclusion
I really like to have fresh OS every 6 months, and yes, I had each version of Fedora on my desktop. Each looks better than the previous one. Time needed for installation is the price you must pay if you want to be in step with Fedora or any other Linux distribution. But you can improve and speed up installation process. Along with the procedure described in this article, you can have a fully functional version of new Fedora in a couple of hours. In my case this means to have FireFox, Eclipse, Evolution and Documents ready and configured.

I hope you have found some interesting thoughts …

Leave a Comment