LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (http://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Moving user account to new install of Linux? (http://www.linuxquestions.org/questions/linux-newbie-8/moving-user-account-to-new-install-of-linux-808411/)

taylorkh 05-17-2010 03:13 PM

Moving user account to new install of Linux?
 
I am beginning plans to upgrade my "production" desktop from Ubuntu 9.10 to 10.04 LTS. Based on what I have read and experienced with "upgrades" it is better to install the new version from scratch. That is what I plan to do. The next task is to install the various additional programs I wish to have. I can make a list of them and do the installs no problem.

So now I get to the question of my user account information. I have my current system built with the following file systems:

/ (for the OS)
/home (for my account)
/data (for all "data" including Firefox and Thunderbird profiles, OpenOffice.org documents and other data files)

Moving my "data" to the new OS will not be an issue. My user account information is stored in /home/ken. Can this be moved to the new OS? I would like to avoid having to redo gnome and program preferences and configurations, icons on the panel, saved passwords, ssh bookmarks and other stuff which Linux has stored in /home/ken.

I have created an Ubuntu virtual machine and tried a couple of approaches to transferring the files under /home/ken. The results were not promising. Is moving my profile a practical idea or should I just take a couple of hours and tweak everything on the new OS to my liking?

TIA,

Ken

p.s. If I rebuild my profile are there any things I can do to make it "portable" in the future? For when I move to 12.04 LTS?

AlucardZero 05-17-2010 03:23 PM

Yes, feel free to move /home/ken. There should be few issues. Just make sure file ownership is the same (not an issue if you're the only user, but watch for numeric ID differences). I've done exactly what you're proposing and it went pretty well. However there may be some issues if e.g. major software versions have changed.

fruttenboel 05-17-2010 03:31 PM

Quote:

Originally Posted by taylorkh (Post 3971851)
I am beginning plans to upgrade my "production" desktop from Ubuntu 9.10 to 10.04 LTS. Based on what I have read and experienced with "upgrades" it is better to install the new version from scratch. That is what I plan to do. The next task is to install the various additional programs I wish to have. I can make a list of them and do the installs no problem.

So now I get to the question of my user account information. I have my current system built with the following file systems:

p.s. If I rebuild my profile are there any things I can do to make it "portable" in the future? For when I move to 12.04 LTS?

Be VERY careful here!

If you add users via useradd or something similar use the exact same sequence as in the old system. If, on the old system, you installed users ken, bob and joe (in that order) and on the new system the same names but now in the order bob, ke, joe, then bob gets kens user space and vice versa. The names are just shortcuts coupled to the user ID.

For the rest: it's quite safe to keep the old home directory.

Still, what I usually do is:

- rename the old /home to /oldHome
- do the install (with a new /home)
- later copy all relevant files from /oldHome to /home

Or: put the full /home in a tar file and keep it somewhere on the disk (or on a DVD or tape) so you can later access it.

tronayne 05-17-2010 03:39 PM

I would think that you have two choices: create a tar archives of your entire /home directory then gzip the archive and copy it to a flash or CD-ROM or DVD drive (and do the same with any other directory tree you want to "save"); or (and I'm not sure you can do this with Ubuntu) see if you can selectively not format and build a file system on the partitions you don't want wiped out. That is, you want to let the installation wipe out and overwrite the root but not /home or /data -- see if you can do that (if you can't, then go with the archive method).

You don't want to simple copy the directory trees to a flash driver (or CD-ROM or DVD or whatever); create tar archives, gzip them and copy those to your media. Then, get your system configured (add user accounts and all that), then extract the archives from the media something like
Code:

log in as root
cd /
tar xzfv /media/device/home.tar.gz
tar xzfv /media/device/data.tar.gz

Hope this helps some.

taylorkh 05-17-2010 04:14 PM

Thanks AlucardZero, fruttenboel and tronayne,

As part of my nightly backup process I execute the following script line
Quote:

tar -cvpzf /quitelarge/_mirror/mirror1/home-ken.gz /home/ken 2>> /quitelarge/_mirror/tar-error.log
/quitelarge is a file system on a separate hard drive. mirror1 is a subdirectory which gets rolled over every night for 7 days giving me a 7 day history. That said, my first attempt to move my profile to the virtual machine went like this

- create VM with my account "ken" as the first user
- created a second user "zorro" as an administrator
- copied a home-ken.gz file to the VM by ssh
- logged in as zorro (so no files owned by ken were in use)
- renamed /home/ken to /home/ken.old
- unzipped/untarred home-ken.gz to /home/ken
- attempted to logon to the VM as ken

When I logged on I got a message
Quote:

Could not update /home/ken/.ICEauthority
followed by several other errors which I did not write down. I never got a panel to load. I killed the VM and replaced it with a copy I made before the experiment. Ready to try again ;)

The second try I logged into the VM as ken and slammed the files from the old machine /home/ken over top of the files in the VM /home/ken. When I logged out and back in I at least got the panel although some programs were missing or had blank launchers (Firefox for example). Fonts were a little hosed up and the window control buttons were large and square (rather than small and round as in Lucid).

Obviously my process still needs some work. As to the /data - that data has migrated over the years from CP/M to DOS to Windows 3.1 to NT to Win 2000 to XP and then to Linux. The only file I recall loosing was a tax worksheet in Supercalc which got corrupted on a diskette from my Osborne. When I loaded it to my first 40 MB hard drive I did not realize that it was bad :o

Ken


All times are GMT -5. The time now is 09:33 PM.