Welcome

Troves being gleaned while surfing on the Internet mostly about computer/IT/system skills and tricks, Welcome here ...
Powered By Blogger

Disclaimer

This blog is written by the owner with real practices and tests and intended to hold all original posts except there is a clear declaration for referencing from others. Thanks for tagging with the source link or other tips for reference from here if you would like to quote partial or full text from posts in this blog.

Friday, December 31, 2010

How to restore or upgrade Fedora linux without losing user data at all

When you are inflicted with some faults of current Linux, the Fedora distribution, say, you might want to restore the OS kernel only without impairing all current user data even user applications installed after the previous installation, just like for Windows 2000/NT/XP/7, etc. there is a "restoring installation" option during the installation tour.

Just follow steps below to achieve this, given all your user data including configurations and profiles even history records like cookies, etc. are located at /home/user, and /home is mounted differently from the OS kernel and its legacy things. For example, you have "df -h" leading to output like following things:

/dev/sda1              99G  7.5G   86G   8% /
tmpfs                 2.0G  468K  2.0G   1% /dev/shm
/dev/sda2             148G   70G   71G  50% /home

[ For upgrading to a higher version of Linux even to a different distribution, the guide below is just exactly suited ]

1. download and place installation package
a. get the OS installation image, Fedora-14-x86_64-DVD.iso, say from the official site

b. extract files and directories from the image and copy them to the partition holding data you want to keep, e.g. the /home at /dev/sda2 in this case

su 
mkdir /mnt/fcinstall
mount -o loop -t iso9660 Fedora-14-x86_64-DVD.iso /mnt/fcinstall

cp -fr /mnt/fcinstall/isolinux/{vmlinuz,initrd.img} /mnt/fcinstall/images  /home
mv Fedora-14-x86_64-DVD.iso /home

* you can also use some unpacking tool for extracting from ISO instead of using mount.


2. edit  /boot/grub/grub.conf and add following :
(presuming current partition is (hd0, 0) in terms of (hard_drive, partition), corresponding to sda1 listed above in this case)

title fcinstall
root (hd0, 0)
kernel /vimlinuz
initrd /initrd.img



 *this is to prepare for a boot item in the bootloader for reinstalling.  You can either add a new item exclusively for this reinstallation like above
or just modify the bootloader item for the Linux in the current use,

3. keep everything you want to retain AWAY from the OS partition, for example, all stuff other than that are under /home/.  if you have ever installed VirtualBox and created an virtual windows Xp image as the root account, you will need to :
move /root/.VirtualBox  /home/user, say.  this step is the first IMPORTANT really.

4. after ascertaining nothing missed on the /home partition as the user data to keep, restart now

5. following steps is verisimilar to the ordinary fresh installation of Linux, except certain cautions as follows:

a. at this step




CHOOSE  "create custom layout"

b. in the partition editing interface,
choose /dev/sda1 to edit, and mount it onto "/", and format it. (it is advisable to format it since we want to a clean fresh installation not patching things up or left garbage there). Should format into "ext4" file system as well.


and, choose /dev/sda2 to edit, NOTE that just to mount it to /home and NEVER choose to format it, otherwise everything we are doing is just of no damn use and become meaningless!  this is the second KEY step, i.e. the single most IMPORTANT step for your goal towards "restorative installation"

c. back to the partition interface and go next, then follow every step as the fresh installation until it is finished and restart again.

6.restore the user profile

Now create the user account you had before, /home/user for instance.


su
useradd -d /home/user -G user -p ******  -s /bin/bash user

By skipping the -m option, a skeleton profile will not be copied to /home/user, and we are to keep using original data all and get it associated with this restored user account as before.

if you like to use GUI, in the following interface
Mind you, do NOT choose "Create home directory".


(Actually after the reinstallation, you DO need a user account other than root to login the system, so just do it right there.  The way I was doing is to create a temporary user account and then delete it just because I wan habituated to think of the command line operation then! )

7. Post restoration - Site clearing !

Now that we get a reinstalled linux and everything kept there just like before the restoration, we can safely remove the boot item for our recovery task.

- edit /boot/grub/grub.conf and remove what we added right now.
- unmount /mnt/fcinstall
- remove the installation image and boot bzImage we copied to /home/ before if you like. Surely you can simply keep them there in case we need another reinstallation afterwards, hope you will not be of that bad luck though :)



Now, you just are going to enjoy everything you have before, including the Desktop, gnome-terminal settings, Mozilla bookmarks even visit history, application (like VirtualBox and Windows Xp virtual OS, etc.) and .....


[ Other Notes ]

From this text, written from my definite practice (which is not so smooth at the time though), we should suggest that in the future use of Linux :

Install new application as into the user partition (or a single other partition than that for holding the OS itself) as possible. The same principles is applicable for data placement. In order to keep this consistency, you have better to designated "--prefix=/home/user/..." if you are to install some extraneous packages and modules by building the source code.

In a word, the more spread you anchored your data, the less handy to do a restorative installation being described.

2 comments:

Unknown said...

Just have a peek to see what you do about writing

Unknown said...

How quickly you Install Oracle Database on Fedora 14? Contact to DB Installation Support
Rapidly introduce the Oracle Database on Fedora 14 with the assistance of Cognegic's DB Installation and Configuration Support or DB Configuration Support. Our progress and easy to understand proficient help guarantees your Oracle database runs ideally. Our specialized specialists assist you with increasing your uptime and furthermore execute determination to perform quicker. They additionally push you to execution tuning, reinforcement and recuperation and high accessibility.
For More Info: https://cognegicsystems.com/
Contact Number: 1-800-450-8670
Email Address- info@cognegicsystems.com
Company’s Address- 507 Copper Square Drive Bethel Connecticut (USA) 06801