FreeBSD newfs options

Sometimes the default formatting options aren’t what you need, so i’ll explain a few of them here.

soft-updates are enabled with the -U option.  Soft updates are generally a good idea, but you might run into problems if you enable them on a smaller partition as it can fill up before the system has had time to release free space to the user.

block size, frag size and inode size can be useful to change depending on your intended data usage.  A single file will always use a minimum of the block size.   If your intended data is likely to be a lot of small files (e.g. a maildir dump disk), then a 64kb block size is insane as a 100byte file will occupy 64kb of disk storage.  inodes can be exhausted if your intended data is likely to be a lot of files.  e.g. if your disk is likely to contain a few thousand large zip files then you need fewer inodes which frees up space for data.

for a disk that needs a lot of small files, i would go for something like:

newfs -O2 -U -b 4096 -f 512 -i 2048 /dev/da0s1a

for a disk that needs fewer files but generally has large files, you could increase the block and inode size:

newfs -O2 -U -b 65536 -f 8192 -i 65536 /dev/da0s1a

The defaults (at least in FreeBSD 7) are…

newfs -O2 -U -b 16384 -f 2048 -i 2048 /dev/da0s1a

2 thoughts on “FreeBSD newfs options

  1. Jan

    L.S.,

    Thanks for the interesting tips and hints. Coming from OS/2 I’m a total newbie concerning FreeBSD but try reading up and getting self-sufficient and will eventually make the total switch to this marvellous OS.

    I’m trying to help my computer illiterate friends to make the move from Vista (which came pre-installed on their new laptop and which they disliked too much) to PC-BSD and the install was a success and they love it. But I got myself into some problems;

    250 GB HD; Originally partitioned in 4 equal parts of 60GB (1 Primary (C:)) and 3 Logical (D:, E:, F:).

    F: was removed and replaced by a Primary ad0s3 where PC-BSD got installed. All OK. Added great packages and ports, MARVELLOUS!

    Now for enabling my friends to run their beloved Win DTP programs I’m preparing the installation of QEMU (and/or Win4BSD) in order to install XP, but I’m running into problems that for now I can’t solve.

    BSD won’t use the 3 accessible NTFS partitions for storage of the QEMU image of XP and besides access seems somewhat slow. So to add disk space to BSD I deleted E: and created a new slice (ad0s4) using the sysinstall utility.

    Trying to mount ad0s4 I run into problems; or the Disk Label Editor wouldn’t write (solved), or the slice doesn’t seem to be mounted, or the system won’t boot because no drive is any longer set active (solved with the FreeBSD LiveFS disk).

    Now how do I add the 60GB slice (ad0s4) to the existing installation on ad0s3, and where should it be mounted to get best results (/var, /usr, or create other for use with QEMU)?

    The latest surprise is that after several tries to do the above with the help of sysinstall (PC-BSD’s and the one of the LiveFS CD) the harddisk presentsitself now as ad4. ???

    Thank you in advance for any help!

    Regards,
    Jan

    Reply
  2. dan Post author

    Hi,

    You would check the slice exists with ‘ls -al /dev/ad0*’ and check that ad0s4 exists there. If you have run newfs on it (or allowed sysinstall to), then it should be mountable.

    I’d suggest mounting it seperately from /var, /usr etc.

    You definately shouldnt see an ad4 unless you’ve added another hard drive in on another controller. ad0, ad1, ad2, ad3 are generally reserved for the onboard controller, then ad4 onwards start from controller 2 (sometimes a SATA controller on newer laptops/motherboards)

    Thanks,

    Dan.

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *