Koozali.org: home of the SME Server

Partial Backup (users ONLY)

Offline NickCritten

  • *
  • 245
  • +0/-0
Partial Backup (users ONLY)
« on: June 06, 2005, 06:54:11 PM »
Hi everyone,

This question has been asked, in one form or another by many different people, about a dozen times over the past 2 1/2 Years (Since I've been using SME) but I have never seen a difinitive answer given. :-?

Here is the Scenario:
    You have a heavily modified SME box (e.g a 6.0.1-01 box with the SME plus Script installed)
    You need to rebuild (or upgrade) to a newer build.
    You want to transfer ONLY the user accounts & user directories (homedrives & emails) NOTHING ELSE.

My Idea is as follows, perform a Backup-to-Desktop, then delete the files and Directories you don't want from the tar.gz file, or use Backup2ws to only backup the files and Directories you want.
Install the new version as new installation (not backup), then drop the backup file back on through server-manager.

I cannot think of any reason why this would not work, right?



My question is this:
Precicely which folders and files are required to copy across ONLY the users... No IBAYs, No Settings, No Qmail Queues, antivirus scripts or cron jobs, nothing... just the users.

My guess is:
/home/e-smith/files/users
/home/e-smith/accounts

I guess also part of the MySQL data aswell, but I'm not sure...

I think this is quite an important thing to know how to do, as many people will want to upgrade to 6.5 or 7 without the risk of screwing up thir install due to packages installed on their old box.

Are there any guru's out there who can access their seemingly infinate Linux/SME knowledge and help us out here?

Many Thanks,
...
Nick

"No good deed goes unpunished." :-x...

Offline raem

  • *
  • 3,972
  • +4/-0
Re: Partial Backup (users ONLY)
« Reply #1 on: June 07, 2005, 12:17:54 PM »
NickCritten

> Precicely which folders and files are required to > copy across ONLY the users...

I believe that you cannot just backup the users "names" only from those files you mentioned, there are other parts that are required, password files etc etc, and the accounts db has other data in it also.

A standard 911 backup2ws job (which will recreate a server without installed contribs) (and the standard backup to desktop is similar) has
/home,/etc/e-smith/templates-custom,/etc/e-smith/templates-user-custom,/etc/group,/etc/gshadow,/etc/passwd,/etc/shadow,/etc/smbpasswd,/etc/ssh,/opt,/root

and excludes /home/httpd


> You want to transfer ONLY the user accounts & user > directories (homedrives & emails) NOTHING ELSE.


Perhaps a simple approach (which I have used on lightly modified servers) would be to recreate the server from the backup2ws 911 job and then just delete the ibays in server manager, leaving only the users and user home folders etc.
Re-run the "Configure this server" routine and adjust accordingly and make any other necessary changes in server manager.

You could delete ibay data from the backup2ws job by including /home/e-smith/files/ibays in the exclusion list field, but the ibays will still be recreated in the restore process as their details are in the accounts database.


The only other tool I'm aware of is the Lazy Administrator Tools (LAT) contrib from Michiel Blotwijk , which is really a rpm & a set of scripts to extract user, group and whatever else information from a server and use the output files to recreate on a new server.
Do a search on LAT and read the user docs for info on how to use.
I have not used it, but by reports I read, it seems to do the job if you are happy to use the method outlined.


> ...without the risk of screwing up thir install
> due to packages installed on their old box.

Personally it would be far easier and less time consuming and less likely to cause problems, to just remove the addon contribs BEFORE you do the upgrade. That is recommended practise after all !

Upgrades are usually supported from one version to the next where the server is stock standard or close to that. Just revert your server by uninstalling and removing appropriate "unsupported" contribs & rpms or application upgrades. There are rpm switches to allow installation of older rpms.

Test first on a clone of your server to see how the upgrade will go, and then remove any problematic programs/contribs that you identify.
...

Offline raem

  • *
  • 3,972
  • +4/-0
Partial Backup (users ONLY)
« Reply #2 on: June 07, 2005, 12:30:13 PM »
This thread may also be of interest (modified accordingly)
http://forums.contribs.org/index.php?topic=27473.0
...

Offline NickCritten

  • *
  • 245
  • +0/-0
Partial Backup (users ONLY)
« Reply #3 on: June 07, 2005, 12:36:36 PM »
Hi RayMichell,  :-)

Ibays aren't much of a problem as they can be added / removed manually, to be honest I don't care if they get copied across or not.

I have also attempted restoring a server from a Backup2desktop file in the past, but I've found it to be really problematic, you get Cron Jobs firing off left right and center for programs that aren't there, the Q-Mail queue is always screwed up, and you get so many error messages appearing in the admin's mailbox, that you end up spending days and days firefighting to get it running properly.

I've used LAT in the past, which would be the way I would go, but it doesn't copy the users emails...

Perhaps one way to do this would be to manually recreate the users on the new box or use LAT to do it, and then copy the email files across, but how is this accomplished?  Somehow I get the feeling that you can't simply copy the contents of the /home/e-smith/files/users/username/maildir directory into onto another machine....

or can you?

Someone please set me straight on this!  :-D
...
Nick

"No good deed goes unpunished." :-x...

mbachmann

Partial Backup (users ONLY)
« Reply #4 on: June 07, 2005, 12:53:47 PM »
This is from tech-geeks.org: http://www.tech-geeks.org/geeklog/article.php?story=20040907083535277
 they have rebuild a dead server only with a backup to desktop file. Does it help?

Offline raem

  • *
  • 3,972
  • +4/-0
Partial Backup (users ONLY)
« Reply #5 on: June 07, 2005, 12:59:07 PM »
NickCritten

> Perhaps one way to do this would be to manually
> recreate the users on the new box or use LAT to do > it, and then copy the email files across...

That sounds like a reasonable combination that is workable.


>  Somehow I get the feeling that you can't simply
> copy the contents of the /home/e-
> smith/files/users/username/maildir
directory
> into onto another machine....
> or can you?

You can do that, just be careful that the resulting folders and files have the correct user ownership & permissions etc eg user1:user1, user2:user2 etc

Compare with the old box.

I did that recently and it works OK.

You could create a seperate backup2ws job just to backup /home/e-smith/files/users/..., as long as the same users are on each server, and restore that after the users have been manually created (or created with LAT).

Note backup2ws is not the same as backup to desktop.


> I have also attempted restoring a server from a
> Backup2desktop file in the past, but I've found it > to be really problematic, ........that you end up > spending days and days firefighting to get it
> running properly.  

That's why I suggested it's easier and less time consuming to properly remove all the added on contribs etc BEFORE doing a upgrade from server to server. It may still involve a few hours work (depending on how much extra stuff you have added) but that is less than days and days of frustration later.
...

Offline NickCritten

  • *
  • 245
  • +0/-0
Partial Backup (users ONLY)
« Reply #6 on: June 07, 2005, 01:15:14 PM »
Quote
That's why I suggested it's easier and less time consuming to properly remove all the added on contribs etc BEFORE doing a upgrade from server to server. It may still involve a few hours work (depending on how much extra stuff you have added) but that is less than days and days of frustration later.


Yeah, some of my boxes are REALLY heavily modified :hammer: ... I would be there for days removing all the contribs, plus one or two don't remove themselves properly (this i know from experience)

I will have a go at copying the user folders across manually... Although, If i perform a Backup to Desktop, then remove everything from the tar.gz file except the /home/e-smith/users folder and the /home/e-smith/Maildir (for admin/root emails). Then i could set up the new server, add the users, then drop the altered backup file on, go in and redo the permissions, this should work shouldn't it?

I think we're onto something here... Asuming it works, I think I'll write some documentation on how to do it...

Thankyou! Come again!
...
Nick

"No good deed goes unpunished." :-x...

Offline NickCritten

  • *
  • 245
  • +0/-0
Partial Backup (users ONLY)
« Reply #7 on: June 07, 2005, 01:18:09 PM »
Quote
mbachmann:
This is from tech-geeks.org: http://www.tech-geeks.org/geeklog/article.php?story=20040907083535277
they have rebuild a dead server only with a backup to desktop file. Does it help?


Thanks for that... I'll have a read; it would be nice to retain the users passwords! :-)
...
Nick

"No good deed goes unpunished." :-x...