Placing my CLI home dir in a different dataset than freenas-boot?

Status
Not open for further replies.

Stilez

Guru
Joined
Apr 8, 2016
Messages
529
Short version: I can imagine there are many ways to move the root user's home directory ("~") off the boot device and onto my main data pool, but some methods will have issues, some won't persist, etc. So what is the best way to go about it?

Longer version: The pool is on heavy duty redundant disks. The boot/install volume is on a simple mirrored pair of not-so-large (40GB) SSDs. If I reinstall, or move the pool to new hardware, I have to manually copy over my home directory. If I want to ensure it's snapped, I have to manually snapshot the boot devices or periodically do a manual/cron copy of its contents to the large pool. It's not as safe and periodically roll-backable as it would be, if stored in my data pool. Especially if I need to reinstall the system or lose the boot pool somehow, if the root dir content is in the data pool, I can't accidentally lose it if there's a boot volume issue or I'm careless at reinstall. Awkward and not elegant.

Ideas I've had (I know, they probably all break everything!):
  • I've thought about moving the directory to a /tank/home_dirs dataset which solves all that, but I suspect this would be unworkable and break everything in the system.
  • I've looked into mounting a pool-based dir over the standard home dir as a unionfs. That would be absolutely ideal, except that unionfs has a large warning "may break everything" on FreeBSD (see man mount pages).
  • I could create a subdir symlinked to the pool dir, and put everything that matters into that directory, but things like .<shell>rc, .login, .profile and others probably expect to be where they are, and will get overwritten, so I won't be able to persist changes in them as easily, or changes to the symlink, which anyway puts my files a level down in the file system - annoying.
  • And anyway, what if the pool goes offline?
  • I could set a startup script in the UI that just checks if the pool is online, and if so, edits the default home dir just to add the symlink dir and append "source FILENAME" to the relevant shell startup files (for interactive sessions only). That seems like it might work and also persist, the main disadvantage being that all my files end up a level down in the hierarchy.
Is there a "good" way to do this without breaking everything?
 

m0nkey_

MVP
Joined
Oct 27, 2015
Messages
2,739
The root user home directory should not be used. The root account is for performing administrative functions only. If you have scripts, put them in their own dataset on your pool. Also, there's a high probability that the /root home directory could be wiped out by an update.
 

Stilez

Guru
Joined
Apr 8, 2016
Messages
529
The root user home directory should not be used. The root account is for performing administrative functions only. If you have scripts, put them in their own dataset on your pool. Also, there's a high probability that the /root home directory could be wiped out by an update.
So should you ever su to root after logging in, or login as root at the console? If so, then you might want to set up some config for the root interactive login (bindkeys, history, video/display, shell options, script dir to add to PATH, etc). What is the correct way to do those, if the root shell account's home dir should not be used/touched/modified?

(If you should never su to root, what is the correct alternative?)
 
Status
Not open for further replies.
Top