Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.debian.user > #227846 > unrolled thread
| Started by | Jesper Dybdal <jd-debian-user@dybdal.dk> |
|---|---|
| First post | 2020-10-16 11:40 +0200 |
| Last post | 2020-10-17 22:50 +0200 |
| Articles | 13 — 10 participants |
Back to article view | Back to linux.debian.user
/home as a symlink? Jesper Dybdal <jd-debian-user@dybdal.dk> - 2020-10-16 11:40 +0200
Re: /home as a symlink? Yoann LE BARS <yoann@le-bars.net> - 2020-10-16 12:00 +0200
Re: /home as a symlink? Jesper Dybdal <jd-debian-user@dybdal.dk> - 2020-10-16 12:20 +0200
Re: /home as a symlink? Yoann LE BARS <yoann@le-bars.net> - 2020-10-16 12:30 +0200
Re: /home as a symlink? Felix Miata <mrmazda@earthlink.net> - 2020-10-16 13:10 +0200
Re: /home as a symlink? Klaus Singvogel <deb-user-ml@singvogel.net> - 2020-10-16 13:50 +0200
Re: /home as a symlink? Greg Wooledge <wooledg@eeg.ccf.org> - 2020-10-16 14:00 +0200
Re: /home as a symlink? Urs Thuermann <urs@isnogud.escape.de> - 2020-10-16 14:00 +0200
Re: /home as a symlink? Jesper Dybdal <jd-debian-user@dybdal.dk> - 2020-10-16 14:10 +0200
Re: /home as a symlink? Stefan Monnier <monnier@iro.umontreal.ca> - 2020-10-16 16:00 +0200
Re: /home as a symlink? deloptes <deloptes@gmail.com> - 2020-10-16 20:30 +0200
Re: /home as a symlink? David Wright <deblis@lionunicorn.co.uk> - 2020-10-16 21:10 +0200
Re: /home as a symlink? Mike Castle <dalgoda+debian@gmail.com> - 2020-10-17 22:50 +0200
| From | Jesper Dybdal <jd-debian-user@dybdal.dk> |
|---|---|
| Date | 2020-10-16 11:40 +0200 |
| Subject | /home as a symlink? |
| Message-ID | <B0unn-3Gv-9@gated-at.bofh.it> |
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
[toc] | [next] | [standalone]
| From | Yoann LE BARS <yoann@le-bars.net> |
|---|---|
| Date | 2020-10-16 12:00 +0200 |
| Message-ID | <B0uGK-3MZ-1@gated-at.bofh.it> |
| In reply to | #227846 |
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 defaults 0 2 It works perfectly fine. Actually, I am doing this for years. Best regards. -- Yoann LE BARS https://le-bars.net/yoann/ Diaspora* : ylebars@framasphere.org
[toc] | [prev] | [next] | [standalone]
| From | Jesper Dybdal <jd-debian-user@dybdal.dk> |
|---|---|
| Date | 2020-10-16 12:20 +0200 |
| Message-ID | <B0v06-48S-11@gated-at.bofh.it> |
| In reply to | #227847 |
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
[toc] | [prev] | [next] | [standalone]
| From | Yoann LE BARS <yoann@le-bars.net> |
|---|---|
| Date | 2020-10-16 12:30 +0200 |
| Message-ID | <B0v9L-4bV-3@gated-at.bofh.it> |
| In reply to | #227849 |
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* : ylebars@framasphere.org
[toc] | [prev] | [next] | [standalone]
| From | Felix Miata <mrmazda@earthlink.net> |
|---|---|
| Date | 2020-10-16 13:10 +0200 |
| Message-ID | <B0vMu-4E9-13@gated-at.bofh.it> |
| In reply to | #227849 |
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/
[toc] | [prev] | [next] | [standalone]
| From | Klaus Singvogel <deb-user-ml@singvogel.net> |
|---|---|
| Date | 2020-10-16 13:50 +0200 |
| Message-ID | <B0wpc-4Qt-5@gated-at.bofh.it> |
| In reply to | #227849 |
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/<username>
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
[toc] | [prev] | [next] | [standalone]
| From | Greg Wooledge <wooledg@eeg.ccf.org> |
|---|---|
| Date | 2020-10-16 14:00 +0200 |
| Message-ID | <B0wyS-4TB-3@gated-at.bofh.it> |
| In reply to | #227858 |
> > > 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/<username>
>
> 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.
[toc] | [prev] | [next] | [standalone]
| From | Urs Thuermann <urs@isnogud.escape.de> |
|---|---|
| Date | 2020-10-16 14:00 +0200 |
| Message-ID | <B0wyS-4TB-5@gated-at.bofh.it> |
| In reply to | #227849 |
Jesper Dybdal <jd-debian-user@dybdal.dk> 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
[toc] | [prev] | [next] | [standalone]
| From | Jesper Dybdal <jd-debian-user@dybdal.dk> |
|---|---|
| Date | 2020-10-16 14:10 +0200 |
| Message-ID | <B0wIx-5cd-9@gated-at.bofh.it> |
| In reply to | #227860 |
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
[toc] | [prev] | [next] | [standalone]
| From | Stefan Monnier <monnier@iro.umontreal.ca> |
|---|---|
| Date | 2020-10-16 16:00 +0200 |
| Message-ID | <B0yr0-60c-5@gated-at.bofh.it> |
| In reply to | #227846 |
> 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
[toc] | [prev] | [next] | [standalone]
| From | deloptes <deloptes@gmail.com> |
|---|---|
| Date | 2020-10-16 20:30 +0200 |
| Message-ID | <B0CEi-eI-9@gated-at.bofh.it> |
| In reply to | #227846 |
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
[toc] | [prev] | [next] | [standalone]
| From | David Wright <deblis@lionunicorn.co.uk> |
|---|---|
| Date | 2020-10-16 21:10 +0200 |
| Message-ID | <B0DgZ-Hh-3@gated-at.bofh.it> |
| In reply to | #227846 |
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.
[toc] | [prev] | [next] | [standalone]
| From | Mike Castle <dalgoda+debian@gmail.com> |
|---|---|
| Date | 2020-10-17 22:50 +0200 |
| Message-ID | <B11jj-6xx-3@gated-at.bofh.it> |
| In reply to | #227846 |
[Multipart message — attachments visible in raw view] — view raw
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
[toc] | [prev] | [standalone]
Back to top | Article view | linux.debian.user
csiph-web