Moving hard drives on openSUSE

Since upgrading to openSUSE 11.4, I’ve been getting warnings about the hard drive dying – Thank you SMART disk monitoring! I’ve customized my openSUSE install a fair bit, and really didn’t want to setup everything again. Here’s what I did.

  • Ordered new hard drive and waited for it to arrive
  • Did a package dump with zypper
rpm -qa --queryformat '%{name}\n' > package_list.txt
  • Removed the dodgy hard drive and installed the new hard drive
  • Ran the openSUSE 11.4 installer and installed the base
  • Booted up the new system
  • Attached the old hard drive via a PATA to USB connector
  • Brought up a terminal and moved the files across
cd /home
cp -prf  USERNAME/ /home/
  • While the files were being moved over I setup the external repositories again
  • Open a new terminal and go into the correct folder for the package dump list
zypper in $(cat package_list.txt)
  • Sit back and wait for the packages to be rebuilt, and the files to move over.
  • When the files have been moved over, the ownerships need to be changed.
cd /home/
find . -user root -exec chown USERNAME.users {} \;
  • Now if you logout and log back in, your system should be pretty much the same way it was before you had to move drives.

Why, I hear you ask, should I bother doing all this?

  1. You get all the packages you used to use from repos (non repo packages need to be installed manually)
  2. Your Evolution emails don’t need to be reimported from the server
  3. Bookmarks, saved passwords and tabs are exactly the way you left them for FireFox and Chrome
  4. Pidgin will have all your settings
  5. Your keyring, including all the wireless passwords, are exactly the same.
  6. Desktop alterations such as locations of panels, background, screensaver, etc, are exactly the same
  7. I’m lazy and didn’t want to setup everything again