Contents
Should I Backup usr?
If the packages themselves aren’t important to you, it should be enough to backup /usr/local/etc/ and /usr/local/src/ . /opt/ if you didn’t store anything here, you don’t need to back it up. If you stored something here, you are in the best position to decide, if you want to back it up.
What is usr etc?
/etc is the place where configuration files for the local O/S are located. /usr is containing directories that can be shared between O/Ses, and can be mounted read-only. If /usr/etc exists, it contains configuration files shared by different machines.
What is the var partition?
Purpose. /var contains variable data files. This includes spool directories and files, administrative and logging data, and transient and temporary files. If /var cannot be made a separate partition, it is often preferable to move /var out of the root partition and into the /usr partition.
What is etc shadow?
/etc/shadow is a text file that contains information about the system’s users’ passwords. It is owned by user root and group shadow, and has 640 permissions .
Is there a way to restore a deleted / USR Directory?
Quite frankly I have never come across a method that will work every time. Since the partition that contains the deleted /usr directory most likely has an ext3 or ext4 filesystem – given that the system is Ubuntu 16.04 – the first utility that we are going to implement is extundelete.
How to reinstall all packages in / usr?
Simply to reinstall the packages, you have to chroot into your broken system, create a temporary /usr, get a list of all packages that have files installed in /usr using dpkg -S /usr then reinstall them or extract and copy the necessary files.
How do I restore / USR from a partition?
First you need to change the current working directory to a directory on a partition which has enough free space to hold the recovered /usr directory. To find a directory with enough free space use the df -h command. The typical /usr directory is close to 10 gigabytes in size, so choose a partition with at least this much free space.
How to restore / USR / Dev / SDA1 files?
The final restoration is done in the following manner. extundelete –restore-directory /usr /dev/sda1. If this method works, there will be a subdirectory of your current working directory called RECOVERED_FILES which contains the recovered files i.e. the directory /usr and its contents.