FreeBSD ZFS: Advanced format (4k) drives and you

Historically, hard drives have had a sector size of 512 bytes. This changed when drives became large enough for such a small sector size to make the overhead of keeping track of these sectors consume too much storage space, making hard drives more expensive to produce than strictly necessary. Many modern drives are tagged as “advanced format” drives; Right now, this means they have a sector size of 4096 bytes (4KiB). This includes most if not all SSDs, and most 2TB+ magnetic drives.

If you create a partition on such a drive without ensuring the partition begins on a physical sector, the device firmware will have to do some “magic” which takes more time than not doing the magic in the first place, resulting in reduced performance. It is therefore important to make sure you align partitions correctly on these devices. I generally align partitions to the 1MiB mark for the sake of being future proof. Even though my current drives have 512B and 4KiB sector sizes, I don’t want to encounter any problems when larger sector sizes are introduced.

Although ZFS can use entire devices without partitioning, I use GPT to partition and label my drives. My labels are generally reference to physical location in the server. For example, Bay1.2 would mean the drive is located in bay one slot two. This makes it so much easier to figure out which drive to replace when the need arise.

Continue reading

Status Update

It has been a very busy couple of months, especially with getting a new puppy last month.

I’m in the process of restructuring my personal infrastructure! In extremely broad terms, this will simplify and clarify each servers role, hopefully making it easier and more predictable to maintain the infrastructure. I’ll write a in-depth post on this at a later date!

I’ve also been working on a number of projects related to the game Anarchy Online. Probably most notable is the launch of Demoder’s PlanetMap Viewer v1.2, adding many new features which are described in the thread. Work have begun on sanitizing the Itemsbot and CIDB tool chain by making an independent resource database parser which handles all items, nanos, icons and a few other data types. I’ll go into detail on this later. Vha.Net and Vha.Chat is being upgraded from .NET 2.0 to .NET 4.0 (client profile), and is receiving a new packet system in the process. I’m currently on the planning stage for porting Helpbot to Bot#; No ETA yet.

Photography status: Slacking! I’ve taken some less-than-stellar photographs, and have not bothered uploading these; I am probably going for a photo spree this weekend though; Hopefully I’ll be able to take some which are upload-worthy. :)

My game time is pretty evenly split between Civilization 5 and The Secret World – an amazing modern-time MMO RPG. If you didn’t check it out yet, you should – Ragnar Tørnquist, the man behind The Longest Journey, is the main guy behind the game.  The story easily sucks you in like a good book which you just can’t put down till you’ve finished reading. Quests are very original and fun – I end up doing quests not for their XP or loot, but for the story and direct entertainment value.

Towerwars.info didn’t update correctly this weekend

It was brought to my attention that towerwars.info didn’t update correctly this weekend. When I looked at the site, I noticed there were nothing new since 5th May. That’s a day and a half of quiet; And knowing the Anarchy Online community, that only happens when they’re physically prevented from raging war. Something was wrong.

Continue reading

FreeBSD: kern.securelevel

Quoting the security(7) man page: The kernel runs with five different security levels. Any super-user process can raise the level, but no process can lower it.

The security levels are:

  • -1 Permanently insecure mode – always run the system in insecure mode. This is the default initial value.
  • 0 Insecure mode – immutable and append-only flags may be turned off. All devices may be read or written subject to their permissions.
  • 1 Secure mode – the system immutable and system append-only flags may not be turned off; disks for mounted file systems, /dev/mem and /dev/kmem may not be opened for writing; /dev/io (if your platform has it) may not be opened at all; kernel modules (see kld(4)) may not be loaded or unloaded.
  • 2 Highly secure mode – same as secure mode, plus disks may not be opened for writing (except by mount(2)) whether mounted or not. This level precludes tampering with file systems by unmounting them, but also inhibits running newfs(8) while the system is multi- user. In addition, kernel time changes are restricted to less than or equal to one second. Attempts to change the time by more than this will log the message “Time adjustment clamped to +1 second”.
  • 3 Network secure mode – same as highly secure mode, plus IP packet filter rules (see ipfw(8), ipfirewall(4) and pfctl(8)) cannot be changed and dummynet(4) or pf(4) configuration cannot be adjusted.

FreeBSD: Some thoughts

Why do anyone use a specific OS, really?

I use FreeBSD for servers, because I like the robustness and stability (both software stability, and development/API stability). FreeBSD is a “full package”; It’s a kernel, and userland, which go hand in hand. By default, no services are running. (some exceptions, such as cron)
Continue reading