Date: Mon, 30 Sep 2002 15:22:48 +0100 From: Matthew Seaman <m.seaman@infracaninophile.co.uk> To: "Marc G. Fournier" <scrappy@hub.org> Cc: Matthew Seaman <m.seaman@infracaninophile.co.uk>, Giorgos Keramidas <keramida@FreeBSD.ORG>, freebsd-questions@FreeBSD.ORG Subject: Re: Per directory disk quotas ... Message-ID: <20020930142248.GA81795@happy-idiot-talk.infracaninophi> In-Reply-To: <20020930100742.I69855-100000@hub.org> References: <20020930095230.GB51277@happy-idiot-talk.infracaninophi> <20020930100742.I69855-100000@hub.org>
next in thread | previous in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20020930142248.GA81795>