{"id":3310,"date":"2021-07-17T06:25:29","date_gmt":"2021-07-16T21:25:29","guid":{"rendered":"http:\/\/matoken.org\/blog\/?p=3310"},"modified":"2021-07-17T07:12:11","modified_gmt":"2021-07-16T22:12:11","slug":"linux-ram-limit","status":"publish","type":"post","link":"https:\/\/matoken.org\/blog\/2021\/07\/17\/linux-ram-limit\/","title":{"rendered":"Linux\u306eRAM\u3092\u5236\u9650\u3059\u308b\u30e1\u30e2"},"content":{"rendered":"<div class=\"paragraph\">\n<p>Linux\u3067RAM\u306e\u5c11\u306a\u3044\u72b6\u614b\u306e\u30c6\u30b9\u30c8\u3092\u3057\u305f\u3044\u306a\u3068\u601d\u3063\u3066\u30b3\u30de\u30f3\u30c9\u30e9\u30a4\u30f3\u30aa\u30d7\u30b7\u30e7\u30f3\u306b\u30e1\u30e2\u30ea\u5236\u9650\u306e\u30aa\u30d7\u30b7\u30e7\u30f3\u3092\u3064\u3051\u3066\u8a66\u3057\u3066\u307f\u307e\u3057\u305f\uff0e<\/p>\n<\/div>\n<div class=\"paragraph\">\n<!--more--><\/div>\n<div class=\"paragraph\">\n<p>\u7269\u7406RAM\u30e2\u30b8\u30e5\u30fc\u30eb\u304c\u5236\u9650\u3057\u305f\u3044\u5bb9\u91cf\u306b\u523a\u3057\u76f4\u3059\u3053\u3068\u304c\u3067\u304d\u308c\u3070\u3044\u3044\u306e\u3067\u3059\u304c\uff0c\u90fd\u5408\u306e\u826f\u3044\u30b5\u30a4\u30ba\u306eRAM\u30e2\u30b8\u30e5\u30fc\u30eb\u304c\u3042\u308b\u3068\u306f\u9650\u308a\u307e\u305b\u3093\uff0eLinux\u306e\u8d77\u52d5\u30aa\u30d7\u30b7\u30e7\u30f3\u3067\u5236\u9650\u3067\u304d\u305d\u3046\u3060\u3063\u305f\u306e\u3067\u8a66\u3057\u3066\u307f\u307e\u3057\u305f\uff0e<\/p>\n<\/div>\n<div class=\"paragraph\">\n<p>Linux\u30de\u30b7\u30f3\u3092\u8d77\u52d5\u3057\u3066\uff0cGRUB\u306e\u30e1\u30cb\u30e5\u30fc\u3067\u7de8\u96c6\u3057\u305f\u3044\u30a8\u30f3\u30c8\u30ea\u3092\u77e2\u5370\u4e0a\u4e0b\u30ad\u30fc\u3067\u9078\u629e\u3057\u3066\uff0c <code>e<\/code> \u30dc\u30bf\u30f3\u3092\u62bc\u3057\u3066\u7de8\u96c6\u30e1\u30cb\u30e5\u30fc\u306b\u5165\u308a\u307e\u3059\uff0e<br \/>\n<code>linux \/vmlinuz\u301c<\/code> \u3068\u3044\u3063\u305f\u884c\u306b\u79fb\u52d5\u3057\u3066\u672b\u5c3e\u306b\u8ffd\u52a0\u306e\u8d77\u52d5\u30aa\u30d7\u30b7\u30e7\u30f3\u3092\u8ffd\u8a18\u3057\u307e\u3059\uff0e\u4eca\u56de\u306f\u30e1\u30e2\u30ea\u30922GB\u306b\u5236\u9650\u3057\u305f\u3044\u306e\u3067\uff0c <code>mem=2048m<\/code> \u3092\u6307\u5b9a\u3057\u307e\u3059\uff0e(\u5b9f\u30e1\u30e2\u30ea\u4ee5\u4e0a\u306b\u3082\u8a2d\u5b9a\u3067\u304d\u308b\u3088\u3046\u3067\u3059\u304c\u305d\u3053\u3092\u4f7f\u304a\u3046\u3068\u3057\u305f\u3068\u304d\u306b\u30af\u30e9\u30c3\u30b7\u30e5\u3057\u305d\u3046\u3067\u3059\u306d)<\/p>\n<\/div>\n<div class=\"dlist\">\n<dl>\n<dt class=\"hdlist1\">\u65e7<\/dt>\n<dd><code>linux   \/vmlinuz-5.13.2-mptcp+le9 root=\/dev\/mapper\/yoga\u2014\u200b260\u2014\u200bvg-root ro<\/code><\/dd>\n<dt class=\"hdlist1\">\u65b0<\/dt>\n<dd><code>linux   \/vmlinuz-5.13.2-mptcp+le9 root=\/dev\/mapper\/yoga\u2014\u200b260\u2014\u200bvg-root ro mem=2048m<\/code><\/dd>\n<\/dl>\n<\/div>\n<div class=\"paragraph\">\n<p><code>Ctrl + x<\/code> \u3092\u62bc\u3057\u3066\u3053\u306e\u30aa\u30d7\u30b7\u30e7\u30f3\u3067\u8d77\u52d5\u3057\u307e\u3059\uff0e<\/p>\n<\/div>\n<div class=\"paragraph\">\n<p>\u8d77\u52d5\u3057\u305f\u3089\u78ba\u8a8d\u3057\u3066\u307f\u307e\u3059\uff0e<\/p>\n<\/div>\n<div class=\"listingblock\">\n<div class=\"content\">\n<pre class=\"highlight\"><code class=\"language-shell\" data-lang=\"shell\">$ cat \/proc\/cmdline <b class=\"conum\">(1)<\/b>\nBOOT_IMAGE=\/vmlinuz-5.13.2-mptcp+le9 root=\/dev\/mapper\/yoga--260--vg-root ro mem=2048m\n$ head -1 \/proc\/meminfo <b class=\"conum\">(2)<\/b>\nMemTotal:        2032968 kB\n$ free <b class=\"conum\">(3)<\/b>\n               total        used        free      shared  buff\/cache   available\nMem:         2032968     1575032       70032      161360      387904      139588\nSwap:              0           0           0<\/code><\/pre>\n<\/div>\n<\/div>\n<div class=\"colist arabic\">\n<ol>\n<li>\u30b3\u30de\u30f3\u30c9\u30e9\u30a4\u30f3\u30aa\u30d7\u30b7\u30e7\u30f3\u306e\u78ba\u8a8d<\/li>\n<li>\u30e1\u30e2\u30ea\u306e\u78ba\u8a8d<\/li>\n<li>\u30e1\u30e2\u30ea\u306e\u78ba\u8a8d<\/li>\n<\/ol>\n<\/div>\n<div class=\"paragraph\">\n<p>2GB\u306b\u5236\u9650\u3067\u304d\u305f\u3088\u3046\u3067\u3059 :)<\/p>\n<\/div>\n<div class=\"paragraph\">\n<p>\u8a73\u7d30\u306fKernel\u30c9\u30ad\u30e5\u30e1\u30f3\u30c8\u3092<\/p>\n<\/div>\n<div class=\"listingblock\">\n<div class=\"title\">linux-5.13\/Documentation\/admin-guide\/kernel-parameters.txt<\/div>\n<div class=\"content\">\n<pre>        mem=nn[KMG]     [KNL,BOOT] Force usage of a specific amount of memory\n                        Amount of memory to be used in cases as follows:\n\n                        1 for test;\n                        2 when the kernel is not able to see the whole system memory;\n                        3 memory that lies after 'mem=' boundary is excluded from\n                         the hypervisor, then assigned to KVM guests.\n\n                        [X86] Work as limiting max address. Use together\n                        with memmap= to avoid physical address space collisions.\n                        Without memmap= PCI devices could be placed at addresses\n                        belonging to unused RAM.\n\n                        Note that this only takes effects during boot time since\n                        in above case 3, memory may need be hot added after boot\n                        if system memory of hypervisor is not sufficient.<\/pre>\n<\/div>\n<\/div>\n<div class=\"paragraph\">\n<p>\u4eca\u56de\u306e\u624b\u9806\u306f\u30a2\u30c9\u30db\u30c3\u30af\u306a\u624b\u9806\u3067\u518d\u8d77\u52d5\u3059\u308c\u3070\u5143\u306b\u623b\u3063\u3066\u3057\u307e\u3044\u307e\u3059\uff0e\u3082\u3057\u6c38\u7d9a\u5316\u3057\u305f\u3044\u306e\u3067\u3042\u308c\u3070\uff0c <code>grub.cfg<\/code> \u3092\u66f8\u304d\u63db\u3048\u308c\u3070OK\u306a\u306f\u305a\u3067\u3059\uff0e\u4eca\u56de\u306eDebian Bullseye \u306e\u5834\u5408\u306f\uff0c <code>\/etc\/grub.d\/10_linux<\/code> \u3092\u7de8\u96c6\u3057\u3066 <code>sudo update-grub2<\/code> \u306e\u5b9f\u884c\u3067 <code>\/boot\/grub\/grub.cfg<\/code> \u304c\u66f4\u65b0\u3055\u308c\u307e\u3059\uff0e<\/p>\n<\/div>\n<div class=\"listingblock\">\n<div class=\"title\">\u74b0\u5883<\/div>\n<div class=\"content\">\n<pre class=\"highlight\"><code class=\"language-shell\" data-lang=\"shell\">$ dpkg-query -W grub2* linux-image-`uname -r` procps\ngrub2\ngrub2-common    2.04-19\nlinux-image-5.13.2-mptcp+le9    5.13.2-mptcp+le9-3\nprocps  2:3.3.17-5\n$ lsb_release -dr\nDescription:    Debian GNU\/Linux 11 (bullseye)\nRelease:        11\n$ arch\nx86_64<\/code><\/pre>\n<\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>Linux\u3067RAM\u306e\u5c11\u306a\u3044\u72b6\u614b\u306e\u30c6\u30b9\u30c8\u3092\u3057\u305f\u3044\u306a\u3068\u601d\u3063\u3066\u30b3\u30de\u30f3\u30c9\u30e9\u30a4\u30f3\u30aa\u30d7\u30b7\u30e7\u30f3\u306b\u30e1\u30e2\u30ea\u5236\u9650\u306e\u30aa\u30d7\u30b7\u30e7\u30f3\u3092\u3064\u3051\u3066\u8a66\u3057\u3066\u307f\u307e\u3057\u305f\uff0e<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"webmentions_disabled_pings":false,"webmentions_disabled":false,"activitypub_content_warning":"","activitypub_content_visibility":"","activitypub_max_image_attachments":4,"activitypub_interaction_policy_quote":"anyone","activitypub_status":"","footnotes":""},"categories":[658,7,6,90],"tags":[599,275,679],"class_list":["post-3310","post","type-post","status-publish","format-standard","hentry","category-bullseye","category-debian-linux","category-linux","category-testing","tag-kernel","tag-linux","tag-memory"],"_links":{"self":[{"href":"https:\/\/matoken.org\/blog\/wp-json\/wp\/v2\/posts\/3310","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/matoken.org\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/matoken.org\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/matoken.org\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/matoken.org\/blog\/wp-json\/wp\/v2\/comments?post=3310"}],"version-history":[{"count":0,"href":"https:\/\/matoken.org\/blog\/wp-json\/wp\/v2\/posts\/3310\/revisions"}],"wp:attachment":[{"href":"https:\/\/matoken.org\/blog\/wp-json\/wp\/v2\/media?parent=3310"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/matoken.org\/blog\/wp-json\/wp\/v2\/categories?post=3310"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/matoken.org\/blog\/wp-json\/wp\/v2\/tags?post=3310"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}