How to perform fresh linux install while preserving software raid and user accounts

I have a system with two software raid arrays. The OS is Ubuntu 9.04 and is no longer receiving updates. I'd like to update the system to 12.04 rather than trying to do the automatic update from 9.04-> 9.10-> ... -> 12.04.

My main drive has 2 partitions that are mounted at / and /home.

Is it possible to do a fresh install of linux to the partition where / is mounted while preserving user accounts and preferences (such as passwords, home dir locations, etc...)?

Additionally what do I need to do to keep my software raid array intact following the OS re-install?


Solution 1:

Try the Alternate (text-only) install disc. Get it for example here.

During installation (in particular the part Partitioning your disks), you will be able to manage your current software RAID array and /home partition, while marking your / partition to be re-formatted. Select the partitions and configure it to use the correct mount point manually.

This also works for LVM enabled and volumes using dm-crypt and I've used this many times, avoiding dist-uprades which tend to be a lot slower and hitting more bugs than this approach. The server flavoured disc features the same text-only intaller, by the way.

Some other thoughts:

  • Try it in a virtual machine if you're uncomfortable.
  • Make an external backup of your valuable data.
  • Verify your backups.
  • Did I mention you need to have backups?

Solution 2:

I'd copy of the files containing the user account information (passwd, group, shadow, etc.) out into a separate partition and external storage.

Then you do the install while making sure that the user data /home partition does NOT get formatted but IS used as your /home.

Then you merge the non-system user information back into the new password, group, and shadow files.

If you're feeling ambitious and your have an actual network, the non-system accounts could go into an authentication system like LDAP instead.

I'm also fond of putting all user data in big partition with /home and a /shared directory in there, and then using bind mounts in /etc/fstab. Fewer partitions to worry about then when it comes to re-installs or managing partitions to account for storage growth.