Data Rescue
Overview
I ran into trouble when I attempted to upgrade my laptop from ubuntu 18.04 to 20.04. My relesease_upgrade from Ubuntu 18.04 to Ubuntu 20.04 got hung up, so after waiting quite some time I decided to break out of the upgrade script.
I looked around and version 20.04 seemed well installed and working properly.
I hoped that the version would just work now, So I rebooted without taking any precautions.
The ubuntu boot sequence got hung up but I managed to use a rescue option in the Grub menu that booted an old archived partition of ubuntu16.04 that I happened to have on the drive.
I blindly assumed that my issue was merely which partition was set to active. So I changed that and rebooted and it made matters worse.
uhoh
output:
error: no such partition. Entering rescue mode... grub rescue>
Now nothing booted.
Doh!
What to do?
- Look around.
grub rescue> ls
output:
(hd0) (hd0,msdos3) (hd0,msdos2)(hd0,msdos1)
Those are (device,partition) references.
ls (hd0)
output:
(hd0): Filesystem is unknown.
ls (hd0,msdos2)
output:
(hd0,msdos2): Filesystem is ext2.
Note It guessed ext2, but actually it is ext4.
ls (hd0,msdos2)/home
output:
./ ../ ubuntu/ pierre/
That is the partition I wanted
ls (hd0,msdos1)/home
output:
./ ../ dev/ sysadmin/
The partition that worked, now I want it back working.
Ubuntu live USB to the rescue.
Follow this article: Ubuntu Live Rescue
Ok Now we are back with booting the relic partition. Now this time Preserve Critical Info First
${HOME}/jnut
I maintain a subdirectory on my computer where I put essential files that are important to me. Files that I need to preserve from one incarnation of a workstation to another. Among other things, it contains my latest password database. I preserve this on USB flash drive.
Project sources which were being maintained on the faulty partition.
These projects are under revision control, off the workstation. We still need to preserve the information of where they are and how to access their git repostitory..
Anything else that needs preserving that is not already preserved on jnut.
To accomplish the preservation of the above I recursively copied "/mnt/ubuntu20.04/home/ubuntu/jnut" to USB flash drive.
I copied all the information for 2 and 3 above to a sub-directory "ship_toUSB" and I will also replicate that onto the flash drive. The file "ship_toUSB/billomaterials.txt" indicates what the directoy contains.
cat ship_toUSB/billomaterials.txt
output:
Bill of materials ================= allsources.txt List of project directories on the faulty partition. billomaterials.txt This file. listrepos Bash script to list repos existing on guanabana and give you a few tips. mangobiche16_04.zip Some old jpeg images I want to keep for personal reasons. skeleton.kdbx Transition password database. venv.pdf Doc helps with virtual environements. vwrapper.pdf Same as above. venvlist List of virtual environments under ubuntu on the faulty partition. reqs/ Contains requirements files corresponding to each item in venvlist. Personal Reading lists: Norm-BookList-2021.docx.rtf Norm-BookList-2022.docx.rtf
Among those files two of them are informative enough to list them in this document.
cat ship_toUSB/allsources.txt
output:
# Our project sources make use of git repositories.
# for repos at gituser@guanabana.bernatchez.net you need the ssh private key: id_guanabana_admin
# then git push/pull etc will work properly
# for repos at git@github.com:pierrebernatchez/ you need the key: mangobiche_github,
#
# Note: You can find both private keys in "jnut/private_pack/"
# and their passwords in the password database that holds them "jnut/pierreKeepass.kdbx"
# and also in "ship_toUSB/skeleton.kdbx"
#
# Working copies of these sources existed on the now faulty partition
# in these directories.
#
# from /home/ubuntu/collab:
url = gituser@guanabana.bernatchez.net:/home/gituser/repos/wait_ssh.git
url = git@github.com:pierrebernatchez/handyhelper.git
url = git@github.com:promotionefx/animbboard.git
url = git@github.com:pierrebernatchez/latexhelper.git
url = gituser@guanabana.bernatchez.net:/home/gituser/repos/peripherals.git
url = gituser@guanabana.bernatchez.net:/home/gituser/repos/restdocs.git
url = gituser@guanabana.bernatchez.net:/home/gituser/repos/metarepos.git
url = git@github.com:pierrebernatchez/mathsansmystere.git
url = gituser@guanabana.bernatchez.net:/home/gituser/repos/personalnotes.git
url = git@github.com:pierrebernatchez/msmsite.git
# from /home/ubuntu/repos:
url = git@github.com:pierrebernatchez/srcgif.git
url = gituser@guanabana.bernatchez.net:/home/gituser/repos/srctemplate.git
url = git@github.com:pierrebernatchez/minifirewall.git
url = gituser@guanabana.bernatchez.net:/home/gituser/repos/ubuntuprereq.git
url = gituser@guanabana.bernatchez.net:/home/gituser/repos/bernatchez_staticweb.git
url = git@github.com:pierrebernatchez/srcgeek.git
url = git@github.com:pierrebernatchez/srcdrawhead.git
url = gituser@guanabana.bernatchez.net:/home/gituser/repos/ogopogo_staticweb.git
url = gituser@guanabana.bernatchez.net:/home/gituser/repos/geekutils.git
url = gituser@guanabana.bernatchez.net:/home/gituser/repos/bboards.git
url = gituser@guanabana.bernatchez.net:/home/gituser/repos/cssbootstrap.git
cat ship_toUSB/venvlist
output:
# # List of virtual python environment directories that existed under # the home/ubuntu/ directory on the faulty partition. # I am not sure which if any were still relevant, nor which projects # assumed which virtual environment. But just in case, I have # captured each one's context with a 'pip freeze' so that any one of # these can presumably be resored for use with any any of the projects. # # The list indicates each environment's saved requirements context file. # devpi_venv reqs/devpi_venv_requirements.txt django_venv reqs/django_venv_requirements.txt latexhelper_venv reqs/latexhelper_venv_requirements.txt mathsansmystere_venv reqs/mathsansmystere_venv_requirements.txt msm_site_venv reqs/msm_site_venv_requirements.txt msmsite_venv reqs/msmsite_venv_requirements.txt restdocs_venv reqs/restdocs_venv_requirements.txt
When I was ready to copy the files to the USB flash drive I ran into another issue. This resolved it.
Epilog
Now this important data is backed up to USB flash drive I feel more adventurous.
I have decided to correct my 20.04 partition by simply re-using the partition space to install a recent version of UBUNTU onto it from scratch.
But first just as an added fallback precaution, I plan to deep copy everything under /home/ubuntu onto the old 16.04 partition.