Jamf Nation, hosted by Jamf, is the largest Apple IT management community in the world. Dialog with your fellow IT professionals, gain insight about Apple device deployments, share best practices and bounce ideas off each other. Join the conversation.
if you use your diskutil command to also find the /dev/disk0s? number of the disk umount -f thefounddevice diskutil mount thefounddevice and it should then use the fstab to mount at the new mount point but... if you had stuff written to /Users or /Users/Shared you might want to rsync that to the other partition and clean it up before unmounting and mounting over the /Users directory.
well if you make a script and put it in your configuration for your image, it will run whenever you tell it to. expand on the script that bentoms put up get the device, rsync any data off the existing users directory to the other partition, unmount, remount and you should have it the way you want it.
I personally use the label to mount so when the computer boots it mounts the disk the first time at the right place and put the fstab file on the computer to start with. but that does create some problems when you target disk mode another computer with a userdata partition, it mounts right on top of the one you really want mounted so you have to think a little if using the label method.
thanks Todd.. i am running the script at post 3 at imaging, the partitions exist yet it doesn't seem to work..
Do i need to to target the drive using $1 or something?
Like you mentioned about the the label name.. it's an issue we've come across. I'm not looking to rsync the data at this stage either.. just wishing to find a way to create the stab using us UUID via a script.
well the script that you posted is right except you have to write to the disk you are imaging, not sure what the variable would be, if its in a package its $3
sorry i was not catching on that it was your script. if it were me it would probably be in a systemsetup package and then when it installed you would use $3 for sure.
and then your script would look like #!/bin/sh
usersUUID=diskutil info Users\ HD | grep Volume\ UUID: | awk '{print $3}'\
i tried the script to run it with a launch daemon because my script does some stuff that root needs to do. Sadly it does tab correctly and looks like this
Hi Ben, please can you clarify if you run the script as a policy or as part of the first run script or do you add a post install script to the packaged fstab?
I needed some condition checks to make sure its a MacPro, with a Volume called RLUSERS and already has a fstab (from imaging).
Hope someone finds it useful
#!/bin/bash
\# This script is used to make sure the users data is set to a separate HDD on a partition called RLUSERS for Mac Pro machines ONLY.
\# This is to make things easier for machine rebuilds and disaster recovery. The user will not need to back up their data prior to a machine rebuild if this is in place.
\# This works only with an existing fstab in the imaging process
############ Hardcoded variables are set here ##################
I agree it would be nice if the Oxford University guys posted their case study, as they did say that they would, and I'm sure it would be beneficial to many people. However, I reckon they are more likely to if you call them Oxford instead of Cambridge! I'll mail them and see if I can prompt a response on this.
'echo' is a little confusing on macs. Linux man pages will inform you of a '-e' option for including extended characters, which does actually work on macs even though it isn't mentioned in the mac man pages. Weirdly though, at least this is my experience, the 'root' account has '-e' by default, whilst other accounts don't!!!
...However, this is better than relying on echo. Let the shell pass the tab to echo
echo "hello"$'\t'"jamfnation" > /tmp/tabtest
This means that it wont matter what version of echo you are using, who is logged in, etc. It will matter what shell type you are using though, for example this wont work in tcsh, but then neither will echo with or without a '-e' option!!!
I can only see this a viable option now by having some kind of fixed and locked storage to desks. Just what I thought, more costs!
Also the whole point about the fstab is to trick the operating system in the event the machine needs a rebuild. The user comes back from lunch and its done, all automatically with no fiddling about.
@gregneagle How are you doing this? CoreStorage trickery? I know you can change a users folder location after the fact but it's a manual procedure in the user advanced options.
A little background?
Sure.. kinda like the last 2 posts: https://jamfnation.jamfsoftware.com/discussion.html?id=78
i have this so far but am unsure how to get it to work at imaging:
if you use your diskutil command to also find the /dev/disk0s? number of the disk
umount -f thefounddevice
diskutil mount thefounddevice and it should then use the fstab to mount at the new mount point
but... if you had stuff written to /Users or /Users/Shared you might want to rsync that to the other partition and clean it up before unmounting and mounting over the /Users directory.
Hi Todd.. what??
I'd like this to run at imaging.. via the casper imaging app, any pointers?
well if you make a script and put it in your configuration for your image, it will run whenever you tell it to.
expand on the script that bentoms put up get the device, rsync any data off the existing users directory to the other partition, unmount, remount and you should have it the way you want it.
I personally use the label to mount so when the computer boots it mounts the disk the first time at the right place and put the fstab file on the computer to start with. but that does create some problems when you target disk mode another computer with a userdata partition, it mounts right on top of the one you really want mounted so you have to think a little if using the label method.
thanks Todd.. i am running the script at post 3 at imaging, the partitions exist yet it doesn't seem to work..
Do i need to to target the drive using $1 or something?
Like you mentioned about the the label name.. it's an issue we've come across. I'm not looking to rsync the data at this stage either.. just wishing to find a way to create the stab using us UUID via a script.
well the script that you posted is right except you have to write to the disk you are imaging, not sure what the variable would be, if its in a package its $3
sorry i was not catching on that it was your script. if it were me it would probably be in a systemsetup package and then when it installed you would use $3 for sure.
and then your script would look like
#!/bin/sh
usersUUID=
diskutil info Users\ HD | grep Volume\ UUID: | awk '{print $3}'\echo >> ${3}/private/etc/fstab "UUID=$usersUUID /Users hfs rw"
chown root ${3}/private/etc/fstab
chmod 755 ${3}/private/etc/fstab
and you know i think fstab needs tabs between the elements...
so echo >> ${3}/private/etc/fstab "UUID=$usersUUID /Users hfs rw"
should be this:
echo >> ${3}/private/etc/fstab "UUID=$usersUUID\t/Users\thfs\trw"
maybe the tabs is all i'm missing?.. cheers will test tomorrow.
sadly, still not working.. it doesn't even seem that the script is writing the file to the right location... hmmm..
Script below, $1 variable comes from: https://jamfnation.jamfsoftware.com/article.html?id=146
nvm.. looks like it's an order issue.. will try again monday..
https://jamfnation.jamfsoftware.com/discussion.html?id=2231
Think we needd that script promised by Oxford Uni at the user conf in London!
i tried the script to run it with a launch daemon because my script does some stuff that root needs to do. Sadly it does tab correctly and looks like this
UUID=54AAB218-961C-300B-8CF0-E7ACD503A40B\t/Users\thfs\trw
But... if i delete the fstab and run the script manually, then everything works as expected.
Any ideas?
a thought might be to put a default fstab file in your image with a package that has a line similar to this
UUID=XXXUUIDXXX /Users hfs rw
assuming those are tabs between the elements
then in your script sed -i .bak -e "s/XXXUUIDXXX/$usersUUID/" /private/etc/fstab
I've actually fudged it, just haven't posted yet!
Bascially, @ imaging i deploy a fstab that has the following:
So on 1st boot all the Users HD partition gets mounted at /Users.
My post install policy contains the below which then updates the stab file with the UUID.
Seems ok after 10 macs :)
cheers Ben i'll give it a go. Im really looking forward to this awesome masterpeace
Hi Ben, please can you clarify if you run the script as a policy or as part of the first run script or do you add a post install script to the packaged fstab?
Thanks guys you are utter utter geniuses. I can't thank you ever enough!
Thanks guys this is what i started using below.
I needed some condition checks to make sure its a MacPro, with a Volume called RLUSERS and already has a fstab (from imaging).
Hope someone finds it useful
#!/bin/bash
\# This script is used to make sure the users data is set to a separate HDD on a partition called RLUSERS for Mac Pro machines ONLY.
\# This is to make things easier for machine rebuilds and disaster recovery. The user will not need to back up their data prior to a machine rebuild if this is in place.
\# This works only with an existing fstab in the imaging process
############ Hardcoded variables are set here ##################
file=
ls /etc/fstab\model=
system_profiler | egrep Model\ Identifier | grep MacPro\hdd=
system_profiler SPSerialATADataType | grep RLUSERS | cut -d: -f1\############ Do Not Modify Below This Line #####################
\# Check to see if its a MacPro and fstab exists
if [ "${file}" ] && [ "${model}" ] && [ "${hdd}" ] ; then
\# Move the Shared folder to RLUSERS
mv /Users/Shared/ /Volumes/"${hdd}"/Shared/
\# Pause 10 seconds
sleep 10
\# Make sure the volume RLUSERS is hidden
/usr/bin/SetFile -a V /Volumes/"${hdd}"
\# Get the UUID of the Volume RLUSERS
usersUUID=
diskutil info "${hdd}" | grep Volume\ UUID: | awk '{print $3}'\\# Output the UUID to the fstab file
echo >> $1/private/etc/fstab "UUID=$usersUUID\t/Users\thfs\trw"
\# Change the ownership of the file
chown root:wheel $1/private/etc/fstab
chmod 755 $1/private/etc/fstab
\# Otherwise don't do anything
else
echo "Don't do anything conditions not met!"
fi
exit 0
I agree it would be nice if the Oxford University guys posted their case study, as they did say that they would, and I'm sure it would be beneficial to many people. However, I reckon they are more likely to if you call them Oxford instead of Cambridge! I'll mail them and see if I can prompt a response on this.
'echo' is a little confusing on macs. Linux man pages will inform you of a '-e' option for including extended characters, which does actually work on macs even though it isn't mentioned in the mac man pages. Weirdly though, at least this is my experience, the 'root' account has '-e' by default, whilst other accounts don't!!!
So, if you aren't root, then
otherwise if you are root, then
Kinda odd!
...However, this is better than relying on echo. Let the shell pass the tab to echo
This means that it wont matter what version of echo you are using, who is logged in, etc. It will matter what shell type you are using though, for example this wont work in tcsh, but then neither will echo with or without a '-e' option!!!
But everyone uses bash....right! :)
Rumors are that Apple may screw us over to not have any other internal drives in the new Mac Pros!
https://m.facebook.com/#!/story.php?story_fbid=618830514796717&id=432763186736785&__user=765435081
After everything everyone has done to do this as well! Bye bye redundancy, convenient lunchtime imaging without losing any user data!
Sorry where was Cambridge mentioned?
Anyway all irrelevant now. Apple screwed us over with the new Mac Pros zero extra internal storage.
Bye bye fstab :(
http://www.apple.com/mac-pro/index1.html
It's possible now and will still be possible in the future to create home directories on external storage without editing fstab.
I can only see this a viable option now by having some kind of fixed and locked storage to desks. Just what I thought, more costs!
Also the whole point about the fstab is to trick the operating system in the event the machine needs a rebuild. The user comes back from lunch and its done, all automatically with no fiddling about.
I don't see how it is going to work now.
Oh and because of our client security requirements we cannot and do not allow access to external media. Kinda screwed with the new model now!
FWIW I went with: http://macmule.com/2012/07/31/how-to-use-fstab-within-a-casper-imaging-workflow/
@gregneagle How are you doing this? CoreStorage trickery? I know you can change a users folder location after the fact but it's a manual procedure in the user advanced options.