How might one move a directory (e.g. /usr, /var) installed in a partition separate from the root partition…to the root partition?
My first inclination is to use a live bootable to simply transfer the contents of the partitions containing the target directories to the root partition, however, I’m unsure as to whether the OS would recognize and mount the directories in their new location. Would this be a viable option?
For context, I installed my XFCE system’s root (20 GiB), /var (15 GiB), and /usr (350 GiB) directories in separate partitions (appears to have been a mistake). I now have managed to fill my /var partition and cannot install certain software nor update existing software. To simply my setup and minimize the risk of future conflicts, I’ve decided to merge each under the root directory.
Thank you so much for your time. I’m quite new to using Linux as my primary OS, and am so glad I switched, however, as one might expect, I’ve had a lot to learn and it appears as though this is such a specialty issue that I can’t find anything specific enough to help.
Do you have enough space in your current root partition to hold all the contents of /, /var, and /usr?
If not, then it’ll be a bit more complicated that “simply” move the folders.
Since you already have your /var on a separate partition, /var in root is just the mounting point for that partition. I would boot from a different medium (e.g. USB live environment), copy the contents of the var-partition somewhere else. Then edit partitions if needed, copy stuff from old var-partition to new location and edit the system’s fstab to now mount the new var-location in /var.
You could also try to just resize the partitions you already have - e.g. giving away some space in /usr in favour to increase the size of the var-partition.
If you feel your general partitioning scheme was a mistake (e.g. you now want to move /usr, too), a backup of your /home-directory and a reinstall may be the fastest…
I generally only have a root-partition and /home-partition. Sometimes I create a third partition for a Steam-Library that I mount for my main user only.
First of all, that response was crazy fast. Thank you so much
And I unfortunately don’t have room in my current root for both, however, there would be room for the /var to make a full transfer. I suppose I made a poor choice of words XD
Thank you for such a quick response, let alone one at all.
That’s very good to hear - thank you for the details. I wasn’t sure as to what alterations I would need to make in order to mount the new directory location, and it looks like you explained it fully.
While you are at it: SWAP partitions can be replaced by swap-files without a performance penalty since a long time. Also you will find a WIKI on swap either in Manjaro Wiki or Arch Wiki explaining how to setup swap files with dynamic sizes (systemd based). I have this on my main PC which also happens to have way oversized RAM (I got more than I ordered when I custom ordered the PC because of part availability, I guess). So my swapfile generally is 0MB in size but is available if needed.
Hello,
Correct, if you moved the contents of var- and usr-partition to a real directory within the root-partition ( / ), the former var- and usr-partition do not need to be mounted anymore.