Hello, all!

For a regular install of amd64 NetBSD 8, should the partitions be
4K-aligned for optimal disk I/O performance?

This came up when I read

  https://mail-index.netbsd.org/netbsd-users/2018/08/15/msg021269.html

in which Michael van Elst wrote:

  Can you verify partition alignment? Modern disks require an alignment
  of 4kbyte (8 sectors), otherwise all write operations are executed as
  slow read-modify-write cycles. The effect is also somewhat true for
  reading but usually hidden by the read cache.

Which partitions does this apply to: the MBR partitions (i.e.,
partitions that can be manipulated with fdisk(8)), the NetBSD disklabel
partitions (i.e., partitions that can be manipulated with disklabel(8)),
both, others?

I couldn't find this in the NetBSD guide nor the NetBSD tutorials; did I
miss it?

Does this apply for a VPS (e.g., Vltr's Cloud Compute (VC2))?

Does this apply for a VMware guest where the disk is a sparse virtual
disk file (.vmdk) or a sparse virtual disk file split into multiple
virtual disk files?  The disk is detected by NetBSD 8 as follows (from
dmesg):

===
wd0 at atabus0 drive 0
wd0: <VMware Virtual IDE Hard Drive>
wd0: drive supports 64-sector PIO transfers, LBA addressing
wd0: 20480 MB, 44384 cyl, 15 head, 63 sec, 512 bytes/sect x 41943040 sectors
wd0: 32-bit data port
wd0: drive supports PIO mode 4, DMA mode 2, Ultra-DMA mode 2 (Ultra/33)
wd0(piixide0:0:0): using PIO mode 4, Ultra-DMA mode 2 (Ultra/33) (using DMA)
===

However, Andy Ball's output looked like

===
Model: HGST HTS545025A7E380, Rev: GGEOAC90
Capacity 250 Gbytes, 488397168 sectors, 512 bytes/sector
Physical sector size: 4096 bytes
===

What program displays that kind of information?

Does the NetBSD installer take this into account when it creates the
default MBR partitions and BSD disklabel partitions, or do I need to
watch out and correct it?  For example, I ran

  fdisk

in an amd64 NetBSD 8 VM, and it displayed "bytes/sector: 512" and the
following partition table:

===
0: NetBSD (sysid 169)
    start 63, size 41942977 (20480 MB, Cyls 0-2610/212/34), Active
1: <UNUSED>
2: <UNUSED>
3: <UNUSED>
===

And I ran

  disklabel wd0

and it displayed "bytes/sector: 512" and the following partition table:

===
16 partitions:
#        size    offset     fstype [fsize bsize cpg/sgs]
 a:  40893930        63     4.2BSD   2048 16384     0  # (Cyl.      0*-  43274*)
 b:   1049047  40893993       swap                     # (Cyl.  43274*-  44384*)
 c:  41942977        63     unused      0     0        # (Cyl.      0*-  44384*)
 d:  41943040         0     unused      0     0        # (Cyl.      0 -  44384*)
===

So, it looks like my root file system starts at sector 63, not 64, and
my swap partition starts at sector 40893993, not 40894000, so neither
are 4K-aligned?  I haven't determined that this VM disk is 4K-aligned,
and maybe the NetBSD installer is smart enough to know when it matters,
and perhaps it doesn't matter for this VM disk detected by NetBSD?

Thanks!

Lewis

Reply via email to