Можем ли мы установить размер в синтаксисе tmpfs в процентах вместо статического размера

Вот два варианта получения желаемого результата.

Вы можете удалить ненужные ключи:

jq 'del(.attributes,.name) | 
 .starts[].attributeList = map(.[].attributeList[] | select(.name == "Command"))'

Или вы можете выбрать только те клавиши (и ), которые вам нужны:

jq 'to_entries | map(select(.key == "starts")) | from_entries | 
 .starts[].attributeList = map(.[].attributeList[] | select(.name == "Command"))'

Оба дают один и тот же результат. Также, если вам нужны startsи endsв последнем случае,вы можете просто добавить дополнительные операторы or:map(select((.key == "starts") or (.key == "ends"))).

1
23.03.2020, 06:10
1 ответ

Из документации ядра для tmpfs:

tmpfs has three mount options for sizing:

size:      The limit of allocated bytes for this tmpfs instance. The 
           default is half of your physical RAM without swap. If you
           oversize your tmpfs instances the machine will deadlock
           since the OOM handler will not be able to free that memory.
nr_blocks: The same as size, but in blocks of PAGE_SIZE.
nr_inodes: The maximum number of inodes for this instance. The default
           is half of the number of your physical RAM pages, or (on a
           machine with highmem) the number of lowmem RAM pages,
           whichever is the lower.

These parameters accept a suffix k, m or g for kilo, mega and giga and
can be changed on remount.  The size parameter also accepts a suffix %
to limit this tmpfs instance to that percentage of your physical RAM:
the default, when neither size nor nr_blocks is specified, is size=50%
1
28.04.2021, 23:19

Теги

Похожие вопросы