From owner-freebsd-questions Mon Sep 30 7:23: 1 2002 Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id E8D9137B401; Mon, 30 Sep 2002 07:22:57 -0700 (PDT) Received: from smtp.infracaninophile.co.uk (happy-idiot-talk.infracaninophile.co.uk [81.2.69.218]) by mx1.FreeBSD.org (Postfix) with ESMTP id BFF6943E65; Mon, 30 Sep 2002 07:22:56 -0700 (PDT) (envelope-from m.seaman@infracaninophile.co.uk) Received: from happy-idiot-talk.infracaninophile.co.uk (localhost [IPv6:::1]) by smtp.infracaninophile.co.uk (8.12.6/8.12.6) with ESMTP id g8UEMsOL082149; Mon, 30 Sep 2002 15:22:54 +0100 (BST) (envelope-from matthew@happy-idiot-talk.infracaninophile.co.uk) Received: (from matthew@localhost) by happy-idiot-talk.infracaninophile.co.uk (8.12.6/8.12.6/Submit) id g8UEMn3h082148; Mon, 30 Sep 2002 15:22:49 +0100 (BST) Date: Mon, 30 Sep 2002 15:22:48 +0100 From: Matthew Seaman To: "Marc G. Fournier" Cc: Matthew Seaman , Giorgos Keramidas , freebsd-questions@FreeBSD.ORG Subject: Re: Per directory disk quotas ... Message-ID: <20020930142248.GA81795@happy-idiot-talk.infracaninophi> Mail-Followup-To: Matthew Seaman , "Marc G. Fournier" , Matthew Seaman , Giorgos Keramidas , freebsd-questions@FreeBSD.ORG References: <20020930095230.GB51277@happy-idiot-talk.infracaninophi> <20020930100742.I69855-100000@hub.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20020930100742.I69855-100000@hub.org> User-Agent: Mutt/1.5.1i X-Spam-Status: No, hits=-13.4 required=5.0 tests=IN_REP_TO,QUOTED_EMAIL_TEXT,REFERENCES,SPAM_PHRASE_00_01, USER_AGENT,USER_AGENT_MUTT version=2.41 Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On Mon, Sep 30, 2002 at 10:12:37AM -0300, Marc G. Fournier wrote: > On Mon, 30 Sep 2002, Matthew Seaman wrote: > > > disks of the right size, which you can then put a filesystem onto and > > mount in the correct place. I've seen reports that this technique > > works very well to limit the amount of space a jail(8) can use even if > > the jail's owner has full control over the password file in it. > > Neat, never thought of that ... only issue I could see with using > something like that is that there appears to be no way of 'growing' the > file system if required ... but still, a route to look at ... I believe that disklabel(8) and growfs(8) work just as well on vnode devices as on regular drives. And that unlike a regular drive, it's pretty simple to dd(1) some extra space onto the end of the file... In fact, let me try that: I've created a 128Mb vn device on /dev/vn0a, put a file system on it, mounted it and copied in a bunch of log files: happy-idiot-talk:/mnt/vn0mnt:# df -kh /mnt/vn0mnt Filesystem Size Used Avail Capacity Mounted on /dev/vn0a 124M 136K 114M 0% /mnt/vn0mnt happy-idiot-talk:/mnt/vn0mnt:# disklabel -r /dev/vn0 # /dev/vn0: type: unknown disk: amnesiac label: flags: bytes/sector: 512 sectors/track: 32 tracks/cylinder: 64 sectors/cylinder: 2048 cylinders: 128 sectors/unit: 262144 rpm: 3600 interleave: 1 trackskew: 0 cylinderskew: 0 headswitch: 0 # milliseconds track-to-track seek: 0 # milliseconds drivedata: 0 8 partitions: # size offset fstype [fsize bsize bps/cpg] a: 262144 0 4.2BSD 1024 8192 22 # (Cyl. 0 - 127) c: 262144 0 unused 0 0 # (Cyl. 0 - 127) happy-idiot-talk:/mnt/vn0mnt:# ls -l total 135 -rw-r--r-- 1 root wheel 54681 Sep 30 15:05 messages -rw-r--r-- 1 root wheel 15743 Sep 30 15:05 messages.0.gz -rw-r--r-- 1 root wheel 11631 Sep 30 15:05 messages.1.gz -rw-r--r-- 1 root wheel 11253 Sep 30 15:05 messages.2.gz -rw-r--r-- 1 root wheel 11804 Sep 30 15:05 messages.3.gz -rw-r--r-- 1 root wheel 14268 Sep 30 15:05 messages.4.gz -rw-r--r-- 1 root wheel 15577 Sep 30 15:05 messages.5.gz The aim is to expand that to 256Mb without trashing the contents... happy-idiot-talk:/:# umount /mnt/vn0mnt happy-idiot-talk:/:# vnconfig -u vn0 happy-idiot-talk:/:# dd if=/dev/zero bs=1m count=128 >> /home/vnodes/vn0backingstore 128+0 records in 128+0 records out 134217728 bytes transferred in 6.030322 secs (22257141 bytes/sec) happy-idiot-talk:/:# vnconfig -s labels -c vn0 /home/vnodes/vn0backingstore happy-idiot-talk:/:# disklabel -r -w vn0 auto happy-idiot-talk:/:# disklabel -e vn0 [ add in 'a' partition data ] happy-idiot-talk:/:# disklabel -r vn0 # /dev/vn0c: type: unknown disk: amnesiac label: flags: bytes/sector: 512 sectors/track: 32 tracks/cylinder: 64 sectors/cylinder: 2048 cylinders: 256 sectors/unit: 524288 rpm: 3600 interleave: 1 trackskew: 0 cylinderskew: 0 headswitch: 0 # milliseconds track-to-track seek: 0 # milliseconds drivedata: 0 8 partitions: # size offset fstype [fsize bsize bps/cpg] a: 524288 0 4.2BSD 1024 8192 22 # (Cyl. 0 - 255) c: 524288 0 unused 0 0 # (Cyl. 0 - 255) happy-idiot-talk:/:# growfs -y -s 524288 /dev/vn0a new filesystemsize is: 262144 frags growfs: 524288 sectors in 128 cylinders of 1 tracks, 4096 sectors 256.0MB in 6 cyl groups (22 c/g, 44.00MB/g, 10624 i/g) super-block backups (for fsck -b #) at: 270368, 360480, 450592 happy-idiot-talk:/:# fsck /dev/vn0a ** /dev/vn0a ** Last Mounted on /mnt/vn0mnt ** Phase 1 - Check Blocks and Sizes ** Phase 2 - Check Pathnames ** Phase 3 - Check Connectivity ** Phase 4 - Check Reference Counts ** Phase 5 - Check Cyl groups 8 files, 136 used, 253927 free (7 frags, 31740 blocks, 0.0% fragmentation) happy-idiot-talk:/:# mount -t ufs /dev/vn0a /mnt/vn0mnt happy-idiot-talk:/:# cd /mnt/vn0mnt happy-idiot-talk:/mnt/vn0mnt:# df -kh . Filesystem Size Used Avail Capacity Mounted on /dev/vn0a 248M 136K 228M 0% /mnt/vn0mnt happy-idiot-talk:/mnt/vn0mnt:# ls -la total 137 drwxr-xr-x 2 root wheel 512 Sep 30 15:05 ./ drwxr-xr-x 3 root wheel 512 Sep 30 15:00 ../ -rw-r--r-- 1 root wheel 54681 Sep 30 15:05 messages -rw-r--r-- 1 root wheel 15743 Sep 30 15:05 messages.0.gz -rw-r--r-- 1 root wheel 11631 Sep 30 15:05 messages.1.gz -rw-r--r-- 1 root wheel 11253 Sep 30 15:05 messages.2.gz -rw-r--r-- 1 root wheel 11804 Sep 30 15:05 messages.3.gz -rw-r--r-- 1 root wheel 14268 Sep 30 15:05 messages.4.gz -rw-r--r-- 1 root wheel 15577 Sep 30 15:05 messages.5.gz So, success. The only gotchas seem to be: i) You've got to unconfigure and the reconfigure /dev/vn0 before it will pick up the new size of the backing store. ii) You should use disklabel to add a partition of type 4.2BSD rather than just using the /dev/vn0c whole "disk" partition that's automatically created --- growfs(8) will only operate on 4.2BSD partitions. iii) growfs(8) has to be told the new size of the filesystem, rather than picking it up automatically. Cheers, Matthew -- Dr Matthew J Seaman MA, D.Phil. 26 The Paddocks Savill Way Marlow Tel: +44 1628 476614 Bucks., SL7 1TH UK To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message