From owner-freebsd-questions@freebsd.org Tue Oct 18 13:32:07 2016 Return-Path: Delivered-To: freebsd-questions@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4C3EAC165EE for ; Tue, 18 Oct 2016 13:32:07 +0000 (UTC) (envelope-from steve@sohara.org) Received: from smtp3.irishbroadband.ie (smtp3.irishbroadband.ie [62.231.32.5]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1841B86 for ; Tue, 18 Oct 2016 13:32:06 +0000 (UTC) (envelope-from steve@sohara.org) Received: from [89.127.62.20] (helo=smtp.lan.sohara.org) by smtp3.irishbroadband.ie with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.76) (envelope-from ) id 1bwUUs-0006L8-1P; Tue, 18 Oct 2016 14:32:02 +0100 Received: from [192.168.63.1] (helo=steve.lan.sohara.org) by smtp.lan.sohara.org with smtp (Exim 4.87 (FreeBSD)) (envelope-from ) id 1bwUVI-000E5w-VG; Tue, 18 Oct 2016 13:32:28 +0000 Date: Tue, 18 Oct 2016 14:31:58 +0100 From: Steve O'Hara-Smith To: galtsev@kicp.uchicago.edu Cc: freebsd-questions@freebsd.org Subject: Re: pw add user slow Message-Id: <20161018143158.792fc79ebfb7edc4ee0c4ecd@sohara.org> In-Reply-To: <60719.69.209.239.247.1476794773.squirrel@cosmo.uchicago.edu> References: <20161018074415.0f6575675db30d0b83d9b8ec@sohara.org> <60719.69.209.239.247.1476794773.squirrel@cosmo.uchicago.edu> X-Mailer: Sylpheed 3.5.0 (GTK+ 2.24.29; amd64-portbld-freebsd10.1) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 Oct 2016 13:32:07 -0000 On Tue, 18 Oct 2016 07:46:13 -0500 (CDT) "Valeri Galtsev" wrote: > > On Tue, October 18, 2016 1:44 am, Steve O'Hara-Smith wrote: > > On Mon, 17 Oct 2016 23:36:33 +0100 > > Paul Macdonald wrote: > > > >> > >> Hi, > >> > >> I have to migrate an imap server, which uses about 6000 local accounts > >> for mail delivery > >> > >> I'm using a script that creates system acounts using: > >> > >> /usr/sbin/pw adduser $LOCAL_USER -u$UID-gGID-d $PATH -s/bin/false > >> > >> I'm finding this grows ever more slow, up to 10 seconds per account on > >> a SATA box , and on a test SSD box ( 20 acc's per second initially) > >> even that slows to about 1 account created per second. > >> > >> why does this slow down as more accounts are added? > > > > Because for each one it updates text files (passwd and > > master.passwd) and regenerates databases (pwd.db and spwd.db) from the > > text > > files. The fastest way to do this sort of thing is to directly update > > passwd and master.passwd and then run pwd_mkdb. > > It appears to be sufficient to only edit master.passwd; pwd_mkdb will > re-generate passwd file from master.passwd. Quite right - it's been a while since I last did this. -- Steve O'Hara-Smith