Creating an empty disk with a large block
Disks consist of blocks. By default, the block size of all created disks is 4 KB, but that's not enough for disks larger than 8 TB. You can set the block size when creating an empty disk. You can't change the block size after the disk is created.
The maximum disk size depends on the chosen block size. The size of a newly created disk must be a multiple of 4 MB.
Block size | Maximum disk size |
---|---|
4 KB | 8 TB |
8 KB | 16 TB |
16 KB | 32 TB |
32 KB | 64 TB |
64 KB | 128 TB |
128 KB | 256 TB |
Alert
Selected block size may affect disk performance.
Usually logical block size is equal to 512 bytes. Even though guest OS tries to align i/o to physical block size, it is not always possible. In case the software running in your VM does many read/write operations whose size is less than physical block size, these small operations may reach the disk subsystem. In case of read operations it leads to reading more data than actually requested by software: it's necessary to read at least 1 physical block. In case of write operations the situation is even worse: in order to write an amount of data whose size is less than physical block size, it is necessary to first read the whole physical block, change the requested bytes and then rewrite this block (it's a so called read-modify-write operation). If this write operation is not aligned to physical block boundary, it may be necessary to read and rewrite even 2 physical blocks. Thus, one logical write operation may lead to 2 read operations and 2 write operations at the disk subsystem level. This extra load won't be observable in guest OS metrics, but will be taken into account when the load is compared to the disk limits and will affect performance.
Please, choose large block size only if you are fairly certain that your software uses large requests when working with filesystem / disk. The size of these requests shouldn't be smaller than the selected block size to achieve maximum performance.
The folder specified in the CLI profile is used by default. You can specify a different folder using the --folder-name
or --folder-id
parameter.
-
See the description of the CLI's create disk commands:
yc compute disk create --help
-
Create a disk in the default folder:
yc compute disk create \ --name big-disk \ --block-size 8K \ --size 40G \ --description "my 8k blocksize disk via yc"
This command will create a 40 GB disk with an 8 KB block size, named
big-disk
and described asmy 8k blocksize disk via yc
.- The length can be from 3 to 63 characters.
- It may contain lowercase Latin letters, numbers, and hyphens.
- The first character must be a letter. The last character can't be a hyphen.
-
Get a list of disks in the default folder:
yc compute disk list
Result:
+----------------------+--------------+-------------+---------------+--------+----------------------+-------------------------+ | ID | NAME | SIZE | ZONE | STATUS | INSTANCE IDS | DESCRIPTION | +----------------------+--------------+-------------+---------------+--------+----------------------+-------------------------+ | a7lqgbt0bb9s40tifuhc | first-disk | 20401094656 | ru-central1-a | READY | a7lcvu28njbhnkcteb5n | | | a7lv5j5hm1p1hppprga7 | second-disk | 21474836480 | ru-central1-a | READY | | | +----------------------+--------------+-------------+---------------+--------+----------------------+-------------------------+
Get the same list with more details in YAML format:
yc compute disk list --format yaml
Result:
- id: fhmm0br99mig46rc0em0 folder_id: b1gb9jeqoiordtmv1lbo created_at: "2021-01-11T09:35:05Z" name: big-disk description: 8k blocksize disk type_id: network-hdd zone_id: ru-central1-a size: "42949672960" block_size: "8192" status: READY disk_placement_policy: {}