Script for user's data backups?

ImAMacGuy
Valued Contributor II

We are about to do a hardware refresh on our Macs. Before I go
re-inventing the wheel - does anybody have a script or anything that the
deployment technicians can use to backup / restore the user's data
either to an external drive or a server share?

As a side note, this may be a feature that casper can implement?
Automated backup to specified server shares or something. I know some
other deployment tools offer this functionality, but I haven't seen
anything in casper that can.

John Wojda

Lead System Engineer, DEI

3333 Beverly Rd. B2-338B

Hoffman Estates, IL 60179

Phone: (847)286-7855

Page: (224)532.3447

Team Lead: Matt Beiriger
<mailto:mbeirig at searshc.com;jwojda at searshc.com?subject=John%20Wojda%20Fe
edback&body=I%20am%20contacting%20you%20regarding%20John%20Wojda.>

Mac Tip/Tricks/Self Service & Support <http://bit.ly/gMa7TB>

26 REPLIES 26

golbiga
Contributor III
Contributor III

I just replaced around 70 macs and used Migration Assistant via Firewire on each one. It's not my favorite app, but it's definitely a lot better than it was. I only transfer the User accounts as most of our older machines have antiquated software on it and I just have them run Self Service and install the apps they want. User accounts here range from 15G to 150G (sometimes bigger).

Allen

tlarkin
Honored Contributor

Do you use portable home directories in your environment? A complete
home folder sync will do this. If not, you can script it with rsync and
a log out hook maybe.

ImAMacGuy
Valued Contributor II

Currently we do not. Our main infrastructure is Wintel based and 99% of
the macs do not map to their home folders.

In general the 10.5 / 10.6 systems store to their local folder in Users,
the 10.4 store in domain if I remember correctly.

John Wojda

Lead System Engineer, DEI

3333 Beverly Rd. B2-338B

Hoffman Estates, IL 60179

Phone: (847)286-7855

Page: (224)532.3447

Team Lead: Matt Beiriger
<mailto:mbeirig at searshc.com;jwojda at searshc.com?subject=John%20Wojda%20Fe
edback&body=I%20am%20contacting%20you%20regarding%20John%20Wojda.>

Mac Tip/Tricks/Self Service & Support <http://bit.ly/gMa7TB>

Not applicable

I posted about something along these lines back in November, and forgot to post the scripts we tested for a mass deployment. Sorry for the delay here is the original email I sent explaining what we did. This time the two scripts are attached, I would test them rigorously since the last time we used them was with 10.4. They worked great for me when we tested them before.

Sean

I looked at something like this two years ago when we were looking to do a mass upgrade. We tested it and everything went well, but nothing ever came of it since the project got cancelled. The process involved one script that would backup the All the Users home folders to a share on the network, or fire wire drive, then Casper would erase the drive, image the computer, then a second script would run after the imaging, before the reboot and copy the users data back down. The scripts were from Mike Bombich’s site, a line or two had to be changed. I have not tested it against Leopard, or Snow Leopard so they might need to be updated, and I would suggest more through testing.

tlarkin
Honored Contributor

well how do you purpose to back up the user data? To a network share
or an external? How many users we talking about? Are they savvy
enough to use migration assistant?

ImAMacGuy
Valued Contributor II

Migration assistant? (quickly searching Google).

Oh heck.

That's way easier. See that's why I come here.

John Wojda

Lead System Engineer, DEI

3333 Beverly Rd. B2-338B

Hoffman Estates, IL 60179

Phone: (847)286-7855

Page: (224)532.3447

Team Lead: Matt Beiriger
<mailto:mbeirig at searshc.com;jwojda at searshc.com?subject=John%20Wojda%20Fe
edback&body=I%20am%20contacting%20you%20regarding%20John%20Wojda.>

Mac Tip/Tricks/Self Service & Support <http://bit.ly/gMa7TB>

tlarkin
Honored Contributor

It just depends on your user base. I have some users who are very
savvy and use time machine to back up their own data and when I
refreshed their laptop they actually used TM and migration assistant to
copy their own data. Then I have users that require hand holding for
everything they do. So it varies in my environment. However, if the
user can take care of them self with something that isn't mission
critical I let them do so.

We do home folder sync, so their work data is taken care of
automatically. However, their iPhoto, iTunes, Garageband, iMovie and so
forth is all on them. Then if it is an executive or a director (like my
boss's boss's boss) I make sure I go ahead and do everything for them so
when they get their new computer everything is exactly how it was
before.

donmontalvo
Esteemed Contributor III

I haven't really played with Apple Migration Assistant much in recent years. I know in early versions of Mac OS X it wasn't very reliable. I guess it's something I need to test since we're getting ready to refresh a good number of computers. These are multimedia users who's /Users directory weigh in around 100-300G (on average). If Apple Migration Assistant can migrate all users in one shot, that would be great. If it can handle migration of apps too (seems to be intended to), that would be great too but I'm not sure I would trust it given the kinds of apps these users run. If it can back up to (and restore from) a server, it would be most awesome. I guess I just gave myself another project. ;)

My Wintel colleagues always rib us about Apple's inability to provide enterprise level tools for stuff like this. The Microsoft USMT seems to be the tool of choice for the Wintel side of things...

http://technet.microsoft.com/en-us/library/dd560801(WS.10).aspx.aspx)

Limitations USMT is intended for administrators who are performing large- scale automated deployments. If you are only migrating the user states of a few computers, you can use Windows Easy Transfer for computers running Windows Vista® or Windows® 7.

Don

--
https://donmontalvo.com

ImAMacGuy
Valued Contributor II

That sounds a lot like our users here. I will try it out and report
back. Our rollout is starting next week.

John Wojda
Lead System Engineer, DEI
3333 Beverly Rd. B2-338B
Hoffman Estates, IL 60179
Phone: (847)286-7855
Page: (224)532.3447
Team Lead: Matt Beiriger

tlarkin
Honored Contributor

maybe you guys should start looking at a more centralized data storage infrastructure. Where only needed things are actually saved in the home folder, like documents, and projects that get you way up in the 10s to 100s of gigs are saved on a network share.

Like for example, we only sync ~/Documents here. We do not sync anything else. Preferences are done either post image shell script or pushed out once the client binds via MCX. So I don't need to do a full back up to a home folder.

You could maybe automount shares a log in and point them to (or train your users to manually) copy/link files to the network share. Doing everything locally seems like it would be a huge hassle, and hard drives are pretty cheap, but I understand if you lack the server infrastructure for it.

Otherwise give every user an external HD and give them Time Machine and let them back it up, or look at doing an rsync script to something that backs it up.

Cem
Valued Contributor

I have been using this workflow for couple of years now:

Backup entire HD using Time Machine to external Fire Wire HDD (keep user
data for period of time ­ just for incase if user will come back for
something)
Put new build
Add extra packages / Apps (if needed ­ if user has licence/s)
Migrate user's account from Time Machine Backup
* Convert user's static account to AD account - If it wasn't before (I
have a script that does it in 10 seconds! ­ very simple to use by
technicians) - you can get the script from the link below;
http://blog.macadmincorner.com/migrate-local-user-to-domain-account/

No headache so far...

Cem

donmontalvo
Esteemed Contributor III

Hi Allen,

I'm assuming you used Time Machine to back up first? Just wondered
since I don't see anything on using Migration Assistant to go from Mac
to Firewire drive. Here are a coupel links I found:

http://support.apple.com/kb/HT3231
http://docs.info.apple.com/article.html?path=Mac/10.6/en/27921.html

Thanks,
Don

-- Don Montalvo
Coppell, TX
http://linkedin.com/in/linkedin

--
https://donmontalvo.com

golbiga
Contributor III
Contributor III

Don,

I put the old Mac in target disk mode and then start up Migration Assistant. Depending on Firewire type and amount of data, I'll either move on to the next machine or install some Apps. I've run the migration over ethernet which quits everything including the Finder so the machine is useless until it finishes.

I'll be swapping out another batch of Macs next summer so I'm going to start looking at some alternatives to improve workflow, but honestly it wasn't that bad. My biggest issue right now is the number of 10.5 machines that I'd like to get up to 10.6. I'd like to re-image these machines, but the idea of having everyone back their data up or lets be honest me back their data up sounds extremely painful.

Thanks
Allen

Not applicable

I always and only migrate User Accounts using Terminal

cp -Rp path_to_source path_to_target

Always works like a charm since 10.5.x

-P@

donmontalvo
Esteemed Contributor III

Hi Pat,

Yep, we use ditto. The problem then is having to deal with multiple users, and how to get the data safely over to the new computer in such a way that the local user account on the old computer copies over to the new AD account on the new computer. One user, no problem...multiple users, problem.

Would love to find an easy(ier) way to get this done, ala Microsoft USMT. Wasn't aware you could migrate over the network from old-Mac to new-Mac...gotta test that (hoping it can handle multiple users).

Don

--
https://donmontalvo.com

Not applicable

Migration Agent can handle multiple accounts, but it can be very slow over a network, YMMV. :)

Neal

golbiga
Contributor III
Contributor III

And like I said it will lock the finder so you can't do anything else.

Allen

tlarkin
Honored Contributor

You gotta be careful backing up user home folders because there are a lot of dot files (hidden files) that cp or ditto may not copy with out the proper flags/syntax. Do you want to back up the user's .bashrc or .bash_profile?

Time Machine in my experience is more of an end user solution than it is enterprise. Though if your users can use it, then that is great.

Not applicable

You can also use rsync which works pretty well.

rsync -aPv source destination

Not applicable

When moving User Accounts from one local volume to another I religiously use
cp –Rp

When moving User Accounts to network volumes whether XSAN, AFP or NTFS, I use

#This will copy the Logged in User Account using rsync 2.6.9
rsync -xrlptgoEv --progress ~ /Volumes/destination

Or

#This will copy the Logged in User Account using rsync 3.07
/usr/local/bin/rsync -aNHAXxv --fileflags --protect-decmpfs --force-change --progress ~ /Volumes/destination

I am moving more towards rsync 3.07 since it supports Mac files along with their extended attributes better…. Well, at least that is what they say on the Googlenet ;)

-p@

ImAMacGuy
Valued Contributor II

Some of the systems I'm going to need to migrate are from 10.4 when we
used AdmitMAc to bind them. The users folder is not in users - but
instead in domains...

When I ran the migration asst on these older boxes, it copied the
domains folder in as expected, but it didn't do a cached credentials
account in the users folder. This effectively makes the tool useless
to us for those particular machines.

It wouldn't be a big deal for me or my group, but we are actually having
a "deployment" group handle this and they are far less technical and
probably would have trouble trying to determine on their own if it's
bound with AM, and if so manually copy the folders over.

John Wojda
Lead System Engineer, DEI
3333 Beverly Rd. B2-338B
Hoffman Estates, IL 60179
Phone: (847)286-7855
Page: (224)532.3447
Team Lead: Matt Beiriger

tlarkin
Honored Contributor

Hmm, in 10.4 Netinfo was still being used and now in 10.5 and 10.6 Netinfo is gone and it is all Directory Services. I am not sure if you will be able to migrate a 10.4 account into a 10.6 system. You may have to just copy the data and then fix ownership/permission maybe.

These AD accounts have a UID on the Mac correct?

ImAMacGuy
Valued Contributor II

I can't find any UIDs or anything in Netinfo, the accounts don't even
show up.

daworley
Contributor II

Did you try nicl, the NetInfo command line?

Cheers, - Douglas Worley

Sent from my Tricorder.

ImAMacGuy
Valued Contributor II

Admit mac handled the binding, so it doesn't appear that they got UIDs
or anything. It seems to be that the home folders is in domain instead
of users.

Not applicable

http://rustyisageek.blogspot.com/

Not my scripts, but Rusty Myers has done a clever job of backing up user data, figuring out if they are network or local accounts (and backing up dslocal info as necessary).

These could be adapted for Casper Imaging. I am looking at doing this for our migration to Casper.

Cheers,

Lach