recommendation for filesystem disk alignment of virtual disks

vkhera

Member
Feb 24, 2015
192
14
18
Maryland, USA
For my proxmox server, the ZFS storage is built with ashift=12 for the 4096 aligned blocks to match the modern drives.

For the VM's inside using virtio disks, do I also want to build my file systems 4096 aligned, or is it ok to leave them 512 aligned as per the defaults? The virtio disk is presented to the VM as having 512 byte sectors.

My specific case the VMs are running FreeBSD 10 inside KVM.
 
It is my understanding it would be better to build the filesystems of you VM 4096k aligned, so you're only sending 4k blocks to the hard drive along the I/O pipeline.

Is your drive native 4k ? What is the output of /sys/block/your_hard_drive_device/queue/physical_block_size ?
 
Is your drive native 4k ? What is the output of /sys/block/your_hard_drive_device/queue/physical_block_size ?

According to that variable, they are 512 for my data drives (4x 3TB seagate constellation ES.3), and 4096 for my boot drives (Intel SSD). I thought all modern large drives were 4096 aligned? Hmm...
 
Hum actually it could be that your seagate disk is using 512e (internally 4k but presents itself to OS as 512 bytes sectors)
I also you to read this article about 4k vs 512e
 
According to the seagate docs, linux kernels newer than 2.6.34 will detect the physical sector size properly, so these must be 512. I suppose I will have to pull a drive and look for the "AF" label to make 100% sure.
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!