As the erase block size has been identified, in order to align with it, the previous partitions / volumes configuration are reconfigured.
Proposed Disk Layout
Partition / Volume | Size | Remark |
/dev/vg00/lv00 | 9216MB | / partition in LV (576 LE) |
/dev/sda1 | 256MB | /boot partition |
/dev/vg00/lv01 | 1024MB | swap partition (64 LE) |
/dev/vg00/ev00 | 16GB | encrypted 16GB partition in LV (1000 LE) |
/dev/vg00/lv02 | 32224MB | /data partition in LV (3072 LE) |
free space | 144 LE | free space for snapshot |
Factory CHS & Partition Table
I don't bother with the default CHS, instead I create a /boot partition after the first 16MB erase block, both the size of sda1 & sda2 are divisible by 16.
# sfdisk -luM /dev/sda
Disk /dev/sda: 7783 cylinders, 255 heads, 63 sectors/track
Units = mebibytes of 1048576 bytes, blocks of 1024 bytes, counting from 0
Device Boot Start End MiB #blocks Id System
/dev/sda1 * 16 271 256 262144 83 Linux
/dev/sda2 272 61055 60784 62242816 8e Linux LVM
/dev/sda3 0 - 0 0 0 Empty
/dev/sda4 0 - 0 0 0 Empty
# sfdisk -luS /dev/sda
Disk /dev/sda: 7783 cylinders, 255 heads, 63 sectors/track
Units = sectors of 512 bytes, counting from 0
Device Boot Start End #sectors Id System
/dev/sda1 * 32768 557055 524288 83 Linux
/dev/sda2 557056 125042687 124485632 8e Linux LVM
/dev/sda3 0 - 0 0 Empty
/dev/sda4 0 - 0 0 Empty
Partitioning
Create a LVM physical volume:
# lvm pvcreate --dataalignment 16384k /dev/sda2
Confirm if the PV is properly aligned:
# pvs -o +pe_start
PV VG Fmt Attr PSize PFree 1st PE
/dev/sda2 vg00 lvm2 a- 59.34g 2.25g 16.00m
Create a LVM volume group:
# lvm vgcreate -s 16 vg00 /dev/sda2
Confirm the PE size of the logical volume:
# lvm vgdisplay /dev/vg00 | grep 'PE Size'
PE Size 16.00 MiB
Create a / volume (576 LE x 16):
# lvm lvcreate -n lv00 -L 9216 /dev/vg00
Create a swap volume (64 LE x 16):
# lvm lvcreate -n lv01 -L 1024 /dev/vg00
Create a volume for LUKS (1000 LE x 16):
# lvm lvcreate -n ev00 -L 16000 vg00
Create a volume for /data (2014 LE):
# lvm lvcreate -n lv02 -l 2014 /dev/vg00
Create an ext4 /boot partition:
# mkfs.ext4 -E stripe-width=16384 -b 1024 /dev/sda1
Create an ext4 / volume:
# mkfs.ext4 -E stripe-width=4096 -b 4096 /dev/vg00/lv00
Activate swap partition:
# mkswap /dev/vg00/lv01
Create an ext4 LUKS volume (refer to Part 1 on how to create it):
# mkfs.ext4 -E stripe-width=4096 -b 4096 /dev/mapper/ev00
Create an ext4 /data volume:
# mkfs.ext4 -E stripe-width=4096 -b 4096 /dev/vg00/lv02
Restore
Refer to Part 2 on how to restore the data as well as the boot loader, when necessary.
I/O Scheduler
Edit /etc/rc.local and add the lines highlighted in blue below:
#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.
echo deadline > /sys/block/sda/queue/scheduler
echo 1 > /sys/block/sda/queue/iosched/fifo_batch
exit 0
Everything should be aligned to 16MB erase block, hopefully.
No comments:
Post a Comment