From owner-freebsd-questions@FreeBSD.ORG Fri Aug 10 19:52:55 2007 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 74AD616A417 for ; Fri, 10 Aug 2007 19:52:55 +0000 (UTC) (envelope-from mkhitrov@gmail.com) Received: from nz-out-0506.google.com (nz-out-0506.google.com [64.233.162.232]) by mx1.freebsd.org (Postfix) with ESMTP id 348BA13C46E for ; Fri, 10 Aug 2007 19:52:55 +0000 (UTC) (envelope-from mkhitrov@gmail.com) Received: by nz-out-0506.google.com with SMTP id l8so406799nzf for ; Fri, 10 Aug 2007 12:52:54 -0700 (PDT) DKIM-Signature: a=rsa-sha1; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:to:subject:mime-version:content-type:content-transfer-encoding:content-disposition; b=UoJtBf1ZQyAJcaKZxrIuEu/uicxdNVhaWiiWa9tA1Yshcn9v3B1FCamCJAPj1Ux9/pgByyuSW/H7C/n9r3MXoZ9zaFLoDRFiH2TjFSE5h0y3QmxeEPHt+4PqIwxYiTODwCcH+94UhHwZkTYEf1nK0flw3Apw4Ku+XEtDOTjg9CY= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:to:subject:mime-version:content-type:content-transfer-encoding:content-disposition; b=FxeerAF6NqpklUcdwsK+YmE4FVmOZmP2c5J/jB4BlRztgaxuw7qLi8AUEP5qE9XBmvRTZMkRLhhOAbYR88CThG3YJnvEpnq3xh3rRzembtzqbUeyXE/X8IhamVCJWocsaRwEcr3gH7dOCBnqe8kTeV66tt4dne/RxthAAc4nrOI= Received: by 10.142.254.8 with SMTP id b8mr149724wfi.1186775573381; Fri, 10 Aug 2007 12:52:53 -0700 (PDT) Received: by 10.143.10.17 with HTTP; Fri, 10 Aug 2007 12:52:53 -0700 (PDT) Message-ID: <26ddd1750708101252o531bf67g17e1bcf9095cdc73@mail.gmail.com> Date: Fri, 10 Aug 2007 15:52:53 -0400 From: "Maxim Khitrov" To: freebsd-questions@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Content-Disposition: inline Subject: Need clarification on file system parameters (using newfs). X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 10 Aug 2007 19:52:55 -0000 Hello, I'm installing FreeBSD 7.0 (200606 snapshot) on my laptop just to play around with it out, and I wanted to learn a little bit more about the way FreeBSD organizes the available disk space. Let me tell you what I think I understand about it, and I ask that you please correct me if something is wrong or elaborate a bit more on how everything is related. So first of all, what I'm going to do is use geli full-disk encryption and boot the system from a usb drive. I have an 80GB hard drive, which also has Win XP installed on it. I allocated 20 gigs for windows, about 5 gigs for a shared FAT32 partition in case I need to transfer files between Windows and FreeBSD, and the rest is a geli-encrypted bsd partition. So that's what I want to ask about. As I understand it, a disk is divided into 512 byte sectors, and that is the smallest addressable unit of space. I'll use geli to initialize the entire third partition, bsdlabel it, and finally create all the file systems. Geli offers an option to change the default sector size for better performance, and the recommendation is to use 4KB. Am I correct in assuming that if I do this, then all file systems using this encrypted volume will have 4KB as the smallest addressable unit of space? Once I've created my geli volume, I attach it, label it, and use newfs to prepare everything for use. By the way, this is a bit off-topic, but how does 1GB for /, 2GB for swap (I have 1GB of ram), 1GB for /var, and the rest for /usr sound? I plan to symlink /home to /usr/home and that way have plenty of space for user data and installed software. I haven't done this type of setup before, so thought I'd ask if it is a good idea. Anyway, I'm looking through newfs man page and see several terms that I'm not exactly familiar with. Or rather I am familiar with them, but am not sure how they relate to the finished product (i.e. my file system). First there is the block size set by default to 16KB, and fragment size set to 1/8 of block size. I'm assuming that a block is a group of sectors, but how does fragment size fit into the picture? Does FreeBSD take X number of sectors, make them into a block, and then divide each block into fragments? If so, since the underlying geli layer is using 4KB for sector size, would it make sense for me to modify block and fragment sizes to something a bit bigger? I guess what I'm really unsure about is say I create a file with 1 byte of data in it. What gets allocated? Does that file take up an entire block, or does it get a single fragment? If fragment, then what is the purpose of blocks? There is also the -i option which sets "density of inodes in the file system". It also states that "one inode is required for each distinct file," so when set to 4 * frag-size with frag-size being 2KB, does my 1 byte file end up taking 8KB in the end? If you can, please help me link all these parameters together so I can get a picture of how the file system is actually organized. Also, given what you know about my setup, I'd appreciate any advice for tuning these values to get the best performance for a laptop (i.e. optimized for running user programs as opposed to daemons). Thanks, Maxim Khitrov