Original HOWTO migrate GNU/Linux to bigger disk with clean install and grab all apt-gettable software, settings and files

#HowTo #ByJuho – How to install clean GNU/Linukka aka. GNU/Linux onto bigger laptop 2.5″ HDD and all your apt-get’table applications and document and configuration files from an older smaller disk to bigger?

Curious Tux
Curious Tux pic courtesy of https://pixabay.com/en/penguin-tux-animal-bird-cute-158551/

#needsudo not gonna work without sudo rights

#need $20 USB-to-SATA casing and a screwdriver

#alternative similar effect producing method is to use the casing and use dd  to move partitions around and Gparted to resize them.

# what it doesn’t do? It doesn’t move password file so this will no work for a system then one user. It does not move /root-directory contents in case there is something there and it does not move any server software set-up except for the apt-gettable software.


 

# Run in the old GNU/Linukka to get complete list of # ‘apt-get install’ed packages onto packages.list
‘dpkg –get-selections > packages.list’

# Move this packages.list file (no need to compress it. it is few tens of kilobytes long) to the

# Now you could try
‘sudo dpkg –set-selections < packages.list’
straight ahead but for me it complained about not finding obviously existing packages such as ‘apache2’ so I consulted the dpkg man page

# So first run
‘ sudo apt-get install dselect’
# and run
‘sudo dselect update’

# and you will get the latest fullest catalogue of apt-gettable software from the repositories

# Now you are ready to set dpkg (Debian PacKaGe management) selections from the file
‘sudo dpkg –set-selections < packages.list’

# now install all packages that were set in the previous command from packages.list. This is obviously going to take a some time but you’re almost there.

‘sudo apt-get dselect-upgrade’

# You can now use your favourite method of recovering your files stored in /home are restored

#I didn’t just mount the old /home partition. Instead I put it into a USB-to-SATA casing and used that to connect the HDD into the freshly installed system and copied them over.

# Alternatives are using a 3rd (removable) HDD to move the files or upload to server or cloud and download to new system.

# recursively copying all directories from the old /home partition

‘sudo cp /media/username/UUIDgoeshere /home -R’

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.