Here is a few pointers to make your life simpler.
Scenario 1: – New hard drive, same OS, same version
Make a backup of your home directory.
There are files in use so you need to logout and login with a different user or kill the GUI.
1. Press Ctrl+Alt+F1 to start a console session.
Don’t panic, Ctrl+Alt+F7 or 8 or 9 should take you back to a GUI.
2. Now “kill” the GUI session using the console session to ensure all locked files are released.
/etc/init.d/gdm3 stop
sudo chown -R user:user /home/user/.
sudo chown -R user:user /home/user/*
cp -a /home/user## /media/usb3disk1/backups/home/user##.bckp
or use Rsync:
rsync -rptDuv -e /home/user##/* /media/usb3disk1/backups/home/user##.bckp
Get a list of all your applications.
4. Dump a list of all the installed programs on your old system while still active.
dpkg -l | awk ‘{print $2}’ >
/media/usb3disk1/backups/home/user##/installed_packages.txt
Install a new bigger hard drive.
5. Shutdown and remove the old hard drive.
sudo shutdown -h now
Keep the old drive safe as experience has taught me.
6. Install the new hard drive.
7. Use gparted to create the partitions as required.
sudo gparted
Can you add a directory? of course not, this is linux, nothing is easy. 🙂
8. You need to give yourself access to the drive first. Start a terminal session and type this:
sudo -i
chown -R username:username /media/mynewdisk/.
chown -R username:username /media/mynewdisk/*
Restore your home directory.
9. Move (or copy) the backup home directory to the new disk.
mv /media/usb3disk1/backups/home/user##.bckp /home/user##
or use Rsync
rsync -rptDuv -e /media/usb3disk1/backups/home/user##.bckp/* /home/user##
Re-install your applications.
10. re-install all packages. This is the magic!
sudo apt-get install `cat /media/usb3disk1/backups/home/user##/installed_packages.txt`
Did that work? No? Enclose the command in ” ` ” and not in ” ‘ ” 🙂