0

I have the following query:

I want to increase the I/O size (minimum / optimal) of the CentOS.

By default the value is 512 bytes and I want to increase it to 262144 bytes / 524288 bytes.

Currently executing the fdisk -l command I get the following result:

WARNING: fdisk GPT support is currently new, and therefore in an experimental phase. Use at your own discretion.

Disk /dev/sda: 53.7 GB, 53687091200 bytes, 104857600 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: gpt
Disk identifier: D9567AE9-EB97-4AD7-BA7B-9A2C0EE06951


#         Start          End    Size  Type            Name
 1         2048       411647    200M  EFI System      EFI System Partition
 2       411648      2508799      1G  Microsoft basic
 3      2508800    104855551   48,8G  Linux LVM

Disk /dev/sdb: 42.9 GB, 42949672960 bytes, 83886080 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Identificador del disco: 0x62b5095d

Disposit. Inicio    Comienzo      Fin      Bloques  Id  Sistema
/dev/sdb1            2048    83886079    41942016   8e  Linux LVM
WARNING: fdisk GPT support is currently new, and therefore in an experimental phase. Use at your own discretion.

Disk /dev/sdc: 21.5 GB, 21474836480 bytes, 41943040 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: gpt
Disk identifier: 98228612-062D-4DDC-9CC6-4B849FA55DAF


#         Start          End    Size  Type            Name
 1         2048     41943006     20G  Linux filesyste

2 Answers 2

4

What fdisk is telling you here is a function of the hardware: that it physically has sectors of 512 bytes and that it wishes for them to be addressed logically as 512-byte chunks. While it is possible to set the logical size with hdparm --set-sector-size, there is a large warning in the manual page about doing so and the sizes you want aren't supported.

Moreover, even if you could do that, you probably wouldn't want to, because increasing the sector size means that your file system would have to support such a size (which it doesn't) and that the smallest size your file system could be support would be the logical size, which would mean that storing many small files would be wildly inefficient. In addition, every time you wrote a chunk smaller than the logical size, you'd incur the expense of reading the full chunk from disk and writing the full chunk back, which would hurt performance.

If you want to change the size of a program's I/O operations, you can do so with the program's source code and change the size of the buffers used. However, there isn't a way to do this on a system-wide basis, because in general it's unnecessary and the kernel does the most efficient thing automatically. If you explain a bit more about what you want to do, perhaps we can help you do that.

0

Make a virtual layer or learn to accept your HDD for who it is...

I don't think you can alter the physical sector size of a real drive, but you can overlay it with a logical drive layer that has the properties you want.

I did it for my LUKS partition over an LVM Raid Stripe with this:

sudo pvcreate /dev/sda /dev/sdb
sudo vgcreate <VG_name> /dev/sda /dev/sdb
sudo lvcreate -i 2 -I 256 -l 100%FREE -n <LV_name> <VG_name>

By setting the Sector Size of the logical volume to 256KB.

I was combining two drives into a single raid set, so I already had a virtual layer. But you can just make a logical volume layer of one drive for no other reason than to manipulate its IO handling.

Something like:

sudo pvcreate <YourSad512SectorDrive> 
sudo vgcreate aVolumeOfOne <YourSad512SectorDrive>
sudo lvcreate -I 256 -l 100%FREE -n Fake256KChunkyDrive aVolumeOfOne

Then just partition that badboy!

...

I have not tested the single Chunky-Drive setup, but what I can tell you is that the benchmarks for the LUKS drive I setup showed a performance increase of almost double (against LUKS over a 4KB LVM; not against raw!) in most cases (not for many small files).

Also, the addition of the LUKS layer which is already a soft-layer took care of the sparse-usage issue of small-files automatically for me (the LUKS layer had to handle bundling 256KB IO), but for you just using the logical volume directly ("Fake256KChunkyDrive"), you are going to run into issue of wasted space with small-files.

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.