Alinear discos de bloques físicos de 4k

From Luniwiki
Jump to: navigation, search

Causa

Nuevos discos tienen bloques físicos de 4k, en vez de 512Bytes.

livecd mnt # mkfs -t ext2 /dev/sda1
mke2fs 1.42.10 (18-May-2014)
/dev/sda1 alignment is offset by 512 bytes.
This may result in very poor performance, (re)-partitioning suggested.
Creating filesystem with 32096 1k blocks and 8032 inodes
Filesystem UUID: 0df3d54f-588b-4656-b609-0378fc773711
Superblock backups stored on blocks:
       8193, 24577
Allocating group tables: done
Writing inode tables: done
Writing superblocks and filesystem accounting information: done

Vemos que cfdisk no ha puesto los sectores alineados con los sectores físicos.

livecd mnt # fdisk -lu /dev/sda
Disk /dev/sda: 465.8 GiB, 500107862016 bytes, 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
Disklabel type: dos
Disk identifier: 0x00000000
Partition 1 does not start on physical sector boundary.
Partition 2 does not start on physical sector boundary.
Partition 3 does not start on physical sector boundary.
Partition 4 does not start on physical sector boundary.
Partition 5 does not start on physical sector boundary.
Partition 6 does not start on physical sector boundary.
Device    Boot     Start       End    Blocks  Id System
/dev/sda1             63     64259     32098+ 83 Linux
/dev/sda2          64260   8064629   4000185  83 Linux
/dev/sda3 *      8064630  47134709  19535040  83 Linux
/dev/sda4       47134710 976773167 464819229   5 Extended
/dev/sda5       47134773 351635822 152250525  8e Linux LVM
/dev/sda6      351635886 976773167 312568641  fd Linux raid autodetect

Crear las particiones con fdisk

fdisk crea las particiones contando los bloques físicos de 4k

fdisk /dev/sda
livecd mnt # fdisk -lu /dev/sda
Disk /dev/sda: 465.8 GiB, 500107862016 bytes, 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
Disklabel type: dos
Disk identifier: 0x00000000
Device    Boot     Start       End    Blocks  Id System
/dev/sda1           2048     67583     32768  83 Linux
/dev/sda2          67584   8456191   4194304  82 Linux swap / Solaris
/dev/sda3        8456192  50399231  20971520  83 Linux
/dev/sda4       50399232 976773167 463186968   5 Extended
/dev/sda5       50401280 675541679 312570200  fd Linux raid autodetect
/dev/sda6      675545088 976773167 150614040  8e Linux LVM

La herramienta fdsik crea las particiones en los bloques físicos.

livecd mnt # mkfs -t ext2 /dev/sda1
mke2fs 1.42.10 (18-May-2014)
Creating filesystem with 32768 1k blocks and 8192 inodes
Filesystem UUID: b6d55569-ff8a-43c0-a566-2f86eb7aefca
Superblock backups stored on blocks:
       8193, 24577
Allocating group tables: done
Writing inode tables: done
Writing superblocks and filesystem accounting information: done

Referencias

--Daniel Simao (Talk) 16:24 30 jul 2014 (UTC)