0

I created a separate partition for the /home files and copied the existing files to the new partition but I did not delete the original directory.

When I restart the system the / directory does not show the original /home but after remounting the original partition in a new directory ie mount /dev/sda1 /mnt/sda1 I can see them again, ie at /mnt/sda1/home

Is if it is possible to see the old /home in the / directory without having to remount them in a new directory?

I can imagine the situation where a user notices that the root directory is using more space than the file listing suggests, or would like to access the old directory.

vfclists
  • 7,531
  • 14
  • 53
  • 79
  • Your description is unclear. If you want to see the old /home under the root directory, you have to mount it there. Why is that impossible? – berndbausch Mar 18 '21 at 15:26
  • Your question is similar to this. You can bind mount / (or /home before it's mounted over) somewhere else if it feels "lighter" to you (though technically is no different from mounting /dev/sda1 again). –  Oct 07 '21 at 23:33

2 Answers2

1

You have several options, and I already done them:

  1. mount the old disk on some better place (having sda1 is not the best name: give the disk a name, not the actual location, which may change). Then just symlink the new place of home to the real place: ln -s /var/disks/disk_root_2017 /home and so you can access again /home using the alternate location. Note: this method cannot be used for all standard paths (systems may use ../ and .. has a different meaning across mounting points, compared bash syntax.

  2. just mount your disk as /home and eventually move all content in a new location (e.g. old_root). Then move the content of the old home: mv /home/home/* /home/

Usually one of the two methods is good. And you may want to use a mix of the two, e.g. old home with one method and maybe old /usr/local or /pub or /var/lib/mysql with the other method.

muru
  • 72,889
0

You mount your new partition /home over the directory /home. Therefore, all you see is the new partition. When you unmount the /home partition, the old tree becomes visible again.

If you want to see the old /home directory tree when the new /home partition is mounted, you will have to move it somewhere, e.g.

umount /home
mv /home /home.old
mkdir /home
mount /home

Now, you can access the old home via /home.old and the new /home is mounted in its correct location.

Ljm Dullaart
  • 4,643