From owner-freebsd-hackers Fri Aug 16 1:32:35 2002 Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.FreeBSD.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 2156537B400 for ; Fri, 16 Aug 2002 01:32:32 -0700 (PDT) Received: from harrier.mail.pas.earthlink.net (harrier.mail.pas.earthlink.net [207.217.120.12]) by mx1.FreeBSD.org (Postfix) with ESMTP id B26E143E3B for ; Fri, 16 Aug 2002 01:32:31 -0700 (PDT) (envelope-from tlambert2@mindspring.com) Received: from pool0028.cvx22-bradley.dialup.earthlink.net ([209.179.198.28] helo=mindspring.com) by harrier.mail.pas.earthlink.net with esmtp (Exim 3.33 #1) id 17fcWs-0003fL-00; Fri, 16 Aug 2002 01:32:23 -0700 Message-ID: <3D5CB788.225785BA@mindspring.com> Date: Fri, 16 Aug 2002 01:27:52 -0700 From: Terry Lambert X-Mailer: Mozilla 4.79 [en] (Win98; U) X-Accept-Language: en MIME-Version: 1.0 To: Patrick Thomas Cc: Daniel O'Connor , freebsd-hackers@FreeBSD.ORG Subject: Re: possible to expand a file for vn-device FS usage ? References: <20020816003225.K58763-100000@utility.clubscholarship.com> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG Patrick Thomas wrote: > Thank you for the very clear explanation. Does there exist a utility to > immediately take a partition that has been growfs'd and "fix" it so that > it does not experience this performance penalty ? > > That is, I am willing to sit and wait 10 minutes while some utility > rearranges and reorganizes the unmounted filesystem if it means I don't > have to dump/restore/blah/blah and if it allows me to avoid the > performance penalty you mentioned... You are talking about a defragmenter. It's possible to write one of these, but no one has written one yet, because no one really uses growfs(8) often enough that it ever becomes an issue. So the short answer is "no". The longer answer is that all a defragmenter would do is "make this disk look like it would have looked had i been this size all along". The easiest way to do this is a backup and restore. Note that this does not require a tape drive, if you have enough disk space for the dump image, so it's not like this will be an incredibly time consuming process or anything. How long it would take really depends on the size of your disks, and whether you can use a different drive for the backup image or not (concurrent access to the same disk with a lot of seeks will slow the process by a factor of ~3 on most IDE based systems). The even longer answer is that this sort of thing could forcibly migrate files away from an area of the disk, so it could be used to resize a disk *smaller* (something that isn't supported at all right now), or support relocation and resizing (ala the Power Quest "Partition Magic" program). I actually volunteered to write this code for "$1 and other valuable considerations" for Power Quest, Inc., to get them to support FFS with their tools, several times, but they were not interested. The offer still stands for them; without a payoff like FreeBSD support in the best commercial partitioning product, though, it's probably not worth it just as a standalone project, without cash being involved. Conceptually, if you want to write this code, of it's very easy; all you have to do is create an image of the metadata allocations as they would look on a disk of the appropriate size, if all the files were newly created for the first time, and then rewrite the disk contents to match the image your program has in mind. You can even make it incrementally restartable, by using a file to store the image, and another small file for an intention log, in case there is a power failure during the operation. This assumes that there is enough slack disk space around for you to store the log, and that you can make the log non-colliding with the rest of the FS contents (fairly easy, actually: treat it as an already relocated file in the new FS, and temporarily move file contents around, "fragmenting them worse" to clear the area where you plan to put the log). -- Terry To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message