Re: /home as a symlink?
You could run into issues where the value of 'pwd' does not equal the value of 'readlink -f .'. For myself, I use autofs with autohome. It's been a while since I've looked at the details, but I believe it simply does with bind mount described elsewhere in this thread. My main machines happen to be down at the moment, so I can't provide a working example. Outside of that, I would update /etc/passwd to point to the new location instead. mrc
Re: /home as a symlink?
On Fri 16 Oct 2020 at 11:23:13 (+0200), Jesper Dybdal wrote: > I currently have /home in the root partition. I am considering moving > it to a different existing partition. > > Can I simply move the files and then make /home a symlink to /disk2/home? > > Or perhaps set up a symlink for each user: /home/user1 => /disk2/home/user1? This has the advantage that you can move users' individual home directories at different times, whenever they're not logged in, because they don't all have to reside in one location. > Do either of these run a risk of files under /home being needed before > /disk2 is mounted (it is in fstab)? No, fstab is processed before users are alowed to login. My own systems boot up and run with /home empty¹ (just a mount point directory). Apart from root, the only user who can login is "unlock", because their home directory is in /var/local/home/, and the only thing they can do is unlock an encrypted partition and mount it on /home, whereupon they get logged out. ¹ I lie: they contain an empty file: # ls -l /home/ total 0 -rw-r--r-- 1 root root 0 Nov 27 2019 0 # Cheers, David.
Re: /home as a symlink?
Jesper Dybdal wrote: > Can I simply move the files and then make /home a symlink to /disk2/home? do this and it will be safe. I have a symlink in the root partition to real home for 10+ years. no risk
Re: /home as a symlink?
> Do either of these run a risk of files under /home being needed before > /disk2 is mounted (it is in fstab)? No, a normal boot will typically never look inside /home at all, and if it ever does it should/will likely be quite late, definitely after mounting /disk2. So using symlinks like you suggest is perfectly fine and safe, Stefan
Re: /home as a symlink?
On 2020-10-16 13:49, Urs Thuermann wrote: IIUC, you have a directory on that disk where you want to move the home directories of your users i.e. /some/path/to/homes to, as well as some some other directories on that disk. You could then mount that disk to some mount point, say /data, and then mount --bind /data/some/path/to/homes /home. Thanks! I hadn't thought of that interesting alternative to a symlink. Also many thanks to everybody else who answered. -- Jesper Dybdal https://www.dybdal.dk
Re: /home as a symlink?
Jesper Dybdal writes: > Thanks for your response. That would be the natural way of doing it > if I were partitioning a new disk. But I don't want to do that, and > the target disk also has other data, so /home cannot be a complete > partition. IIUC, you have a directory on that disk where you want to move the home directories of your users i.e. /some/path/to/homes to, as well as some some other directories on that disk. You could then mount that disk to some mount point, say /data, and then mount --bind /data/some/path/to/homes /home. urs
Re: /home as a symlink?
> > > On 2020/10/16 at 11:23 am, Jesper Dybdal wrote: > > > > Can I simply move the files and then make /home a symlink to > > > > /disk2/home? On Fri, Oct 16, 2020 at 01:43:59PM +0200, Klaus Singvogel wrote: > I'm already running my Debian with $HOME set to a different path: > /home.disk2/ > > All I needed to change was the /etc/passwd entry: to the new, different > location; nearly eveything worked fine since then. > > I started with this constellation years ago and never changed the path > afterwards. So I don't have any experience in case of a move. > > The only "program" which caused issues in the past was apparmor. > For this, I modified: /etc/apparmor.d/tunables/home.d/site.local > and added: @{HOMEDIRS}+=/home.disk2 The other points I would bring up, when moving user home directories: 1) The user(s) in question should not be logged in. If you're moving the entire /home then all users should be logged out. Log in directly as root, on the text console if possible. 2) Any long-running user processes may continue to hold open files in the old file system. Either kill off any such processes, or reboot the system after the change.
Re: /home as a symlink?
Jesper Dybdal wrote: > > On 2020-10-16 11:45, Yoann LE BARS wrote: > > On 2020/10/16 at 11:23 am, Jesper Dybdal wrote: > > > Can I simply move the files and then make /home a symlink to /disk2/home? > > You can, but I think a better way is to simply mount the partition as > > /home. > Thanks for your response. That would be the natural way of doing it if I > were partitioning a new disk. But I don't want to do that, and the target > disk also has other data, so /home cannot be a complete partition. I'm already running my Debian with $HOME set to a different path: /home.disk2/ All I needed to change was the /etc/passwd entry: to the new, different location; nearly eveything worked fine since then. I started with this constellation years ago and never changed the path afterwards. So I don't have any experience in case of a move. The only "program" which caused issues in the past was apparmor. For this, I modified: /etc/apparmor.d/tunables/home.d/site.local and added: @{HOMEDIRS}+=/home.disk2 For the future, I see with doubts that systemd wants to make the home directory portable and if this will cause issues for my constelation. Best regards, Klaus. -- Klaus Singvogel GnuPG-Key-ID: 1024R/5068792D 1994-06-27
Re: /home as a symlink?
Jesper Dybdal composed on 2020-10-16 12:18 (UTC+0200): > Yoann LE BARS wrote: >> Jesper Dybdal wrote: >>> Can I simply move the files and then make /home a symlink to /disk2/home? I can't think of a reason why you couldn't, but maybe there is a reason that escapes me why you shouldn't. >> You can, but I think a better way is to simply mount the partition as >> /home. > Thanks for your response. That would be the natural way of doing it if > I were partitioning a new disk. But I don't want to do that, and the > target disk also has other data, so /home cannot be a complete partition. Why do you think the presence of non-home data on a filesystem prevents its use mounted to /home? /home is a perfectly good place to put "other" data on my 40 PCs. -- Evolution as taught in public schools, like religion, is based on faith, not on science. Team OS/2 ** Reg. Linux User #211409 ** a11y rocks! Felix Miata *** http://fm.no-ip.com/
Re: /home as a symlink?
Hello everybody out there! On 2020/10/16 at 12:18 pm, Jesper Dybdal wrote: > Thanks for your response. That would be the natural way of doing it if > I were partitioning a new disk. But I don't want to do that, and the > target disk also has other data, so /home cannot be a complete partition. Alright, I did not get that. Well, in this case, you can indeed make some symlink. In my experience, you can either use a symlink to replace /home or to replace /home/user. Which will be the best way? Well, I guess it depends on what you prefer. Best regards. -- Yoann LE BARS https://le-bars.net/yoann/ Diaspora* : yleb...@framasphere.org
Re: /home as a symlink?
On 2020-10-16 11:45, Yoann LE BARS wrote: On 2020/10/16 at 11:23 am, Jesper Dybdal wrote: Can I simply move the files and then make /home a symlink to /disk2/home? You can, but I think a better way is to simply mount the partition as /home. Thanks for your response. That would be the natural way of doing it if I were partitioning a new disk. But I don't want to do that, and the target disk also has other data, so /home cannot be a complete partition. -- Jesper Dybdal https://www.dybdal.dk
Re: /home as a symlink?
Hello everybody out there! On 2020/10/16 at 11:23 am, Jesper Dybdal wrote: > Can I simply move the files and then make /home a symlink to /disk2/home? You can, but I think a better way is to simply mount the partition as /home. For instance, I have a separated hard drive for my /home, here is its /etc/fstab entry: UUID=35b9219d-1f0a-4b59-8ca5-45c7194ab353 /home ext4 defaults0 2 It works perfectly fine. Actually, I am doing this for years. Best regards. -- Yoann LE BARS https://le-bars.net/yoann/ Diaspora* : yleb...@framasphere.org
/home as a symlink?
I currently have /home in the root partition. I am considering moving it to a different existing partition. Can I simply move the files and then make /home a symlink to /disk2/home? Or perhaps set up a symlink for each user: /home/user1 => /disk2/home/user1? Do either of these run a risk of files under /home being needed before /disk2 is mounted (it is in fstab)? Thanks, Jesper -- Jesper Dybdal http://www.dybdal.dk