Friday, February 25, 2022

How I Installed Peppermint OS PCNetSpec Edition onto a Computer with a Separate Disk as the Home Directory

. . . and kept the original Peppermint settings once I linked my home drive on the alternate disk.

Yep, that's the setup I have on my Acer Aspire 5 thin laptop (using a AMD Ryzen 3 cpu and a AMD Radeon GPU). I have a 119 GB nvme drive, and an alternate SSD drive of 1 TB. I bought that drive once I realized my computer had a spot for it when i was installing more memory in it. It was then that I had the "brilliant" idea of using that spot for my home directory, especially since I was afraid that the nvme card wouldn't be big enough to hold my whole home directory plus system files. So I ordered and installed the drive. I followed some directions on the Internet on how to move my home directory to a separate hard drive. I successfully had a system that gave me plenty of room to expand on both the system (119 GB) and on my home directory (1 TB). Plus, I have a 2 TB external drive which connects via USB for doing my backups.

Now, I had, at the time--after a period of distro hopping (that is a term for anyone who regularly installs new Linux, or other kernel/systems such as BSD, on their computer because of various reasons), looking for a distribution that would work best for me--installed Neptune OS, which uses the KDE Plasma desktop environment (DE). I used that distro for around one year before I decided to distro hop again. If I recall correctly, the first distro hopping I did on this laptop, was in the following progression: Peppermint OS (had a problem updating), Sparky Linux (couldn't get it to install correctly), Garuda Linux (it broke down on an upgrade), Linux Mint Debian Edition (mostly as I needed a stable system and I knew it would work) and a few others I don't recall right now. Somewhere in that first distro hopping period, is when I started using that extra 1 TB drive.

There are several posiitives to doing it this way, but the biggest one is: All of your user settings for the various programs you use are retained upon installing a new distro. For example, upon reconnecting my home directory to the new computer system and opening up my fresh install of Brave or Firefox browser, all of my settings and bookmarks are just as I left them. I was even still logged into my Google account!

Likewise, the main downside is that all of my user settings were retained. Which was a negative when after installing a new distro with, for example the XFCE DE, I would set up the DE like I would want it. But when I connected my home drive to it, all my settings would revert to a previous distro's XFCE's configuration. That actually happened when I first installed Peppermint OS on the Acer, as soon as I connected with my home directory, the panels, theming, wallpapers, all switched over to a previous install of an XFCE DE I had when I ran for a time OpenSUSE, with all its keybindings (the good thing) and all of its inherent problems like the settings for the display not sticking, that is, not being saved and reloaded on a reboot/restart of the session (definitely not a good thing).

So, when it came time to do a fresh install of Peppermint on the system, I decided I wanted to try something I'd not done before. My usual process after installing and updating the system and programs was to reconnect my home drive to the install. "How?"

1) Open a terminal bash session and type:

lsblk

. . . to identify the device location of the home drive. Helps ensure that I've got the correct drive.

2) I then run the following command:

blkid

This will give you a list of the drives and partitions on your disks, but the key part you are looking for is the partition where your home directory is residing. You should be able to see the UUID sequence of letters and numbers in groups of four. It will look something like: xxxx-xxxx-xxxx-xxxx-xxxx. You'll want to mark and copy just the number/letter combination using your mouse to mark the text and holding down the Ctrl and Shift keys at the same time, then pressing and releasing the "C" key. That key combination is usually represented as Ctrl+Shift+C.

If you are on a Debian-based distro, or Debian itself, you may not be able to find the command on your computer. While it is often there in /usr/sbin, it is only that the command's path isn't in the user's path environment variable. To correct that, type in the following command into the terminal:


export PATH="/usr/sbin:$PATH"

It will only last until you close the terminal. To make it a last beyond that terminal session, enter the same command in the .bashrc file, or one it includes. Now, if the program is there, it should show up.

3) Now, I edit the fstab file in the /etc/ directory using your favorite text editor--I tend to use nano since it is on most systems. The purpose of the fstab file is that it will tell your operating system where to mount and find your system, boot files, as well as any other directories such as the one that we just created in our example above.

sudo nano /etc/fstab

4) Then I make an entry for attaching my home directory upon bootup:

I enter "UUID=" then I paste the number/letter that I copied in step 2 above by again holding down the Ctrl and Shift buttons, but this time pressing and releasing the "V" key. Press the spacebar or the tab key, then enter "/home" which will tell the system where to mount the drive. After another space or tab, you'll enter the filesystem it uses, which in most cases will be ext4. Then you'll enter some flags or commands that tell what the drive will do. So after another space or tab, enter "default,noatime", followed by a "0" and a space, then a final 0. By the time you're finished, you should have something that looks like the following, with, of course, your specific UUID code in place of the x's:

UUID=xxxx-xxxx-xxxx-xxxx-xxxx /home ext4 default,noatime 0 0

You'll notice that the pattern matches that of the other drive as well. Once entered, save the file by pressing and holding the Ctrl key, then press the "S" key. Now you are ready to exit the file by once again holding down the Ctrl key while pressing the "X" key.

5) Then, to activate the switch to the new home directory, you'll need to reboot. Once you've done that, you should have access in your home directory to all the files you had on the disk before. The advantage of this is big, in that while I would recommend backing up your home directory, just in case you over write it with your new system you're installing, there is no need to restore your home directory's files from a backed up copy. Plus, as I've already mentioned earlier, you'll automatically have all your user settings for your programs. So, if for instance, if you use Thunderbird as your email client, you won't have to reset up your email accounts again. It's as if you never switched systems.

So what did I do differently to fix my other problem?

1) Certainly before step # 5, but you can do this at any point after you install and update a new system, I'll first create a temp mount point for the old home directory.

For Debian and systems based on it, you'll enter:

cd /media

For Arch and most other systems save a few, you'll add a "/run" directory so that you'll enter:

cd /run/media

2) Then you'll need to create a directory for your user

sudo mkdir $USER

In my case, it would create the directory "rick" so it would read /media/rick

3 ) However, you'll need to change the ownership of the user's directory to the user, so you would enter:

sudo chown $USER:$USER $USER

4) Then you would create the mount point directory inside the user's directory:

cd $USER && mkdir /myhome

5) Then we would mount the directory:

sudo mount /dev/sda1 /media/$USER/myhome

or on non-debian-based systems:

sudo mount /dev/sda1 /run/media/$USER/myhome

Of course, you can name the mount directory anything you desire, within reason. Also, my home directory is on partition 1 of the disk, thus my /dev/sda1 entry. You'll want to put whatever drive and partition that your home directory is located in place of sda1.

What this does is it makes the soon-to-be home directory accessible to you before you mount it as your /home directory.

6) It is easier to do the next part in a file manager. Go into your newly mounted home drive, and go into the ".config" directory. If you don't see it, try pressing Ctrl-H. That will show all the hidden files. Those are all the directories and files that start with a period.

Once in, delete all the folders of past programs that you've used before or you no longer need. Don't worry here about removing something your system might need. Especially good to get rid of old DE directories like XFCE or KDE (which pretty much covers all directories and files that start with a "k"). The only config files and directories that should be remaining are of programs you are currently planning on using. 


For example, I have a file in the .config directory called kitty. it is a terminal application that I prefer using. But, if you fail to keep any config files, all it would mean is that you would have to start over setting up that program.

But the main thing is to delete or rename any desktop environment's configuration files, that will give your system a fresh "blank slate" to put its default setting into. If you don't find the setting file you are looking for in the $HOME/.config directory, check in your $HOME directory as a lot of programs will put their configuration files in there instead of the /.config directory.

Once I've done the above, I would then continue with the steps 1 - 5 above where ever you left off at. Once you've rebooted, you should log into your home directory with all your files intact, including the settings for your programs, yet it won't affect the desktop environment's settings in a bad way.

So, that is how I keep my desktop environment's settings while reusing my /home directory.