[SOLVED] Optimizing disk layout after changing to advanced sector drive?

cosmos

Renowned Member
Apr 1, 2013
125
4
83
Hello all,

got a rather old community-version PVE system running:
Code:
# pveversion -v
proxmox-ve-2.6.32: 3.4-172 (running kernel: 2.6.32-44-pve)
pve-manager: 3.4-13 (running version: 3.4-13/4c745357)
pve-kernel-2.6.32-44-pve: 2.6.32-172
pve-kernel-2.6.32-41-pve: 2.6.32-164
pve-kernel-2.6.32-37-pve: 2.6.32-150
pve-kernel-2.6.32-42-pve: 2.6.32-165
pve-kernel-2.6.32-26-pve: 2.6.32-114
pve-kernel-2.6.32-43-pve: 2.6.32-166
lvm2: 2.02.98-pve4
clvm: 2.02.98-pve4
corosync-pve: 1.4.7-1
openais-pve: 1.1.4-3
libqb0: 0.11.1-2
redhat-cluster-pve: 3.2.0-2
resource-agents-pve: 3.9.2-4
fence-agents-pve: 4.0.10-3
pve-cluster: 3.0-19
qemu-server: 3.4-7
pve-firmware: 1.1-5
libpve-common-perl: 3.0-24
libpve-access-control: 3.0-16
libpve-storage-perl: 3.0-34
pve-libspice-server1: 0.12.4-3
vncterm: 1.1-8
vzctl: 4.0-1pve6
vzprocps: 2.0.11-2
vzquota: 3.1-2
pve-qemu-kvm: 2.2-23
ksm-control-daemon: 1.1-1
glusterfs-client: 3.5.2-1

On this system I'm utilising 3 disks:
* /dev/sda is the boot
* /dev/sdb holds the actual VMs
* /dev/sdc holds backups

/dev/sdb used to be a WD blue drive with a native 512 sector size. For performance reasons I replaced this with a WD Black drive, after using dd_rescue to clone the blue to the black.

System boots and works just fine. However, I'm afraid of the disk performance I am losing due to having partitions on the new /dev/sdb misaligned:
Code:
# fdisk -lu /dev/sdb

Disk /dev/sdb: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 cylinders, total 976773168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk identifier: 0x7e996182

  Device Boot  Start  End  Blocks  Id  System
/dev/sdb1  63  976768064  488384001  7  HPFS/NTFS/exFAT
Partition 1 does not start on physical sector boundary.
Also:
Code:
cat /etc/fstab
# <file system> <mount point> <type> <options> <dump> <pass>
/dev/pve/root / ext3 errors=remount-ro 0 1
/dev/pve/data /var/lib/vz ext3 defaults 0 1
UUID=e1746fa2-eb42-4aa9-a09d-53cd3c6387b2 /boot ext3 defaults 0 1
/dev/pve/swap none swap sw 0 0
proc /proc proc defaults 0 0
/dev/sdc1 /mnt/backups ext3 errors=remount-ro 0 2

This WD disk holds a VG named ExternalStorage on /dev/sdb1:
Code:
# pvdisplay
  --- Physical volume ---
  PV Name  /dev/sdb1
  VG Name  ExternalStorage
  PV Size  465.76 GiB / not usable 1.50 MiB
  Allocatable  yes
  PE Size  4.00 MiB
  Total PE  119234
  Free PE  88770
  Allocated PE  30464
  PV UUID  9EPIVy-go2e-3k2W-L2Y7-5g3Z-NQFj-Bp0XmC

  --- Physical volume ---
  PV Name  /dev/sda2
  VG Name  pve
  PV Size  297.59 GiB / not usable 4.00 MiB
  Allocatable  yes
  PE Size  4.00 MiB
  Total PE  76182
  Free PE  4094
  Allocated PE  72088
  PV UUID  BKx0SX-Ycta-hi1f-24zL-VMb6-O4F6-tubCC0

ExternalStorage VG details:
Code:
# vgdisplay ExternalStorage
  --- Volume group ---
  VG Name  ExternalStorage
  System ID
  Format  lvm2
  Metadata Areas  1
  Metadata Sequence No  28
  VG Access  read/write
  VG Status  resizable
  MAX LV  0
  Cur LV  3
  Open LV  2
  Max PV  0
  Cur PV  1
  Act PV  1
  VG Size  465.76 GiB
  PE Size  4.00 MiB
  Total PE  119234
  Alloc PE / Size  30464 / 119.00 GiB
  Free  PE / Size  88770 / 346.76 GiB
  VG UUID  VPXGW3-DzKg-J6iF-t1jR-fCkr-TbF7-ZUZEAI

Contained in ExternalStorage:
Code:
  --- Logical volume ---
  LV Path  /dev/ExternalStorage/vm-103-disk-3
  LV Name  vm-103-disk-3
  VG Name  ExternalStorage
  LV UUID  pv6pdD-fPCJ-1Rbt-3FGu-k7Sk-jIgr-zXeetc
  LV Write Access  read/write
  LV Creation host, time pve-1, 2015-11-04 13:08:05 +0200
  LV Status  available
  # open  0
  LV Size  24.00 GiB
  Current LE  6144
  Segments  1
  Allocation  inherit
  Read ahead sectors  auto
  - currently set to  256
  Block device  253:1

  --- Logical volume ---
  LV Path  /dev/ExternalStorage/vm-104-disk-1
  LV Name  vm-104-disk-1
  VG Name  ExternalStorage
  LV UUID  bxLeyW-Pb5W-vhOe-hqHs-VdrI-bDgu-7FpXyA
  LV Write Access  read/write
  LV Creation host, time pve-1, 2016-01-04 08:34:59 +0200
  LV Status  available
  # open  1
  LV Size  35.00 GiB
  Current LE  8960
  Segments  1
  Allocation  inherit
  Read ahead sectors  auto
  - currently set to  256
  Block device  253:2

  --- Logical volume ---
  LV Path  /dev/ExternalStorage/vm-100-disk-1
  LV Name  vm-100-disk-1
  VG Name  ExternalStorage
  LV UUID  SlaihD-PDLF-bPgb-0044-cE5A-r1iH-cjncsL
  LV Write Access  read/write
  LV Creation host, time pve-1, 2016-01-05 08:47:25 +0200
  LV Status  available
  # open  1
  LV Size  60.00 GiB
  Current LE  15360
  Segments  1
  Allocation  inherit
  Read ahead sectors  auto
  - currently set to  256
  Block device  253:3

All in all, I'm trying to figure out how to align all things ExternalStorage-related... Being newbie in this area certainly does not help.

Any ideas on how to proceed, has someone tackled this successfully.
 
Replying to myself, I took the logical way of backing up the VMs stored in the WD disk to another disk, removed the VMs, removed the VG, PV and /dev/sdb1 and recreated the latter one. This time it was 4k-aligned. Recreated the PV, VG, configured the Vm storage from web admin and restored the backups. Nicely done with proxmox :)
 
Following up from this... My physical drives are aligned and happy. But, I get notes like this for VM disks. How do I fix that? Do I need to fix that? Is it just a bug in fdisk?

Disk /dev/zd240: 12 GiB, 12884901888 bytes, 25165824 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 8192 bytes
I/O size (minimum/optimal): 8192 bytes / 8192 bytes
Disklabel type: dos
Disk identifier: 0x6fde7e00

Device Boot Start End Sectors Size Id Type
/dev/zd240p1 * 2048 22661119 22659072 10.8G 83 Linux
/dev/zd240p2 22663166 25163775 2500610 1.2G 5 Extended
/dev/zd240p5 22663168 25163775 2500608 1.2G 82 Linux swap / Solaris

Partition 3 does not start on physical sector boundary.

gdisk -l shows:
root@pve2:~# gdisk -l /dev/zd240
GPT fdisk (gdisk) version 0.8.10

Partition table scan:
MBR: MBR only
BSD: not present
APM: not present
GPT: not present


***************************************************************
Found invalid GPT and valid MBR; converting MBR to GPT format
in memory.
***************************************************************

Disk /dev/zd240: 25165824 sectors, 12.0 GiB
Logical sector size: 512 bytes
Disk identifier (GUID): 625685BF-56BC-49F2-B147-0545CC50F87A
Partition table holds up to 128 entries
First usable sector is 34, last usable sector is 25165790
Partitions will be aligned on 2048-sector boundaries
Total free space is 6077 sectors (3.0 MiB)

Number Start (sector) End (sector) Size Code Name
1 2048 22661119 10.8 GiB 8300 Linux filesystem
5 22663168 25163775 1.2 GiB 8200 Linux swap
 
Last edited:
Can't really tell, not a Linux expert here. However, the first/data partition seems to be just fine, so perhaps you could delete the swap and the extended partition and do directly a swap partition. Check if the issue persists.
 

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!