{"id":5571,"date":"2022-04-24T20:27:19","date_gmt":"2022-04-24T11:27:19","guid":{"rendered":"https:\/\/lab4ict.com\/system\/?p=5571"},"modified":"2023-09-03T16:42:15","modified_gmt":"2023-09-03T07:42:15","slug":"ubuntu-server%e3%81%ab%e3%83%87%e3%83%bc%e3%82%bf%e7%94%a8%e3%81%aelvm%e3%82%92%e8%bf%bd%e5%8a%a0%e3%81%99%e3%82%8b%ef%bc%81","status":"publish","type":"post","link":"https:\/\/lab4ict.com\/system\/archives\/5571","title":{"rendered":"Ubuntu Desktop\u306b\u30c7\u30fc\u30bf\u7528\u306eLVM\u3092\u8ffd\u52a0\u3059\u308b\uff01"},"content":{"rendered":"<p>Ubuntu Server\u306b\u30c7\u30fc\u30bf\u7528\u306eLVM\u3092\u8ffd\u52a0\u3057\u307e\u3059\u3002\u4f5c\u696d\u306f\u3001\u7ba1\u7406\u8005\u6a29\u9650\uff08root\u6a29\u9650\uff09\u3067\u884c\u3044\u307e\u3059\u3002<br \/>\n<!--more--><\/p>\n<h2>LVM\u8ffd\u52a0\u7528\u306e\u30c7\u30a3\u30b9\u30af\u3092\u78ba\u8a8d\u3059\u308b\uff01<\/h2>\n<p>\u6700\u521d\u306bLVM\u8ffd\u52a0\u7528\u306e\u30c7\u30a3\u30b9\u30af\u3092\u78ba\u8a8d\u3057\u307e\u3059\u3002\u4f8b\u3048\u3070\u3001\u672a\u4f7f\u7528\u306e\/dev\/sdb\u3092\u30c7\u30fc\u30bf\u7528\u306eLVM\u3068\u3057\u3066\u8ffd\u52a0\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"brush: plain; highlight: [1]; title: ; notranslate\" title=\"\">\r\n# fdisk -l\r\n...\r\nDisk \/dev\/sdb: 953.87 GiB, 1024209543168 bytes, 2000409264 sectors\r\n...\r\n<\/pre>\n<h2>GPT\u3067\u30d1\u30fc\u30c6\u30a3\u30b7\u30e7\u30f3\u3092\u4f5c\u6210\u3059\u308b\uff01<\/h2>\n<p>GPT\u3067\u30d1\u30fc\u30c6\u30a3\u30b7\u30e7\u30f3\u3092\u4f5c\u6210\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"brush: plain; highlight: [1]; title: ; notranslate\" title=\"\">\r\n# fdisk \/dev\/sdb\r\n\r\nWelcome to fdisk (util-linux 2.37.2).\r\nChanges will remain in memory only, until you decide to write them.\r\nBe careful before using the write command.\r\n\r\nDevice does not contain a recognized partition table.\r\nCreated a new DOS disklabel with disk identifier 0xa08b036a.\r\n\r\nCommand (m for help): g\r\nCreated a new GPT disklabel (GUID: D46C70A0-AF28-BF42-89D7-D32B70BA97AC).\r\n\r\nCommand (m for help): n\r\nPartition number (1-128, default 1): \r\nFirst sector (2048-2000409230, default 2048): \r\nLast sector, +\/-sectors or +\/-size{K,M,G,T,P} (2048-2000409230, default 2000409230): \r\n\r\nCreated a new partition 1 of type 'Linux filesystem' and of size 953.9 GiB.\r\n\r\nCommand (m for help): w\r\nThe partition table has been altered.\r\nCalling ioctl() to re-read partition table.\r\nSyncing disks.\r\n<\/pre>\n<p>\u30d1\u30fc\u30c6\u30a3\u30b7\u30e7\u30f3\u300c\/dev\/sdb1\u300d\u304c\u4f5c\u6210\u3055\u308c\u305f\u3053\u3068\u3092\u78ba\u8a8d\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"brush: plain; highlight: [1]; title: ; notranslate\" title=\"\">\r\n# fdisk -l | grep \/dev\/sdb\r\nDisk \/dev\/sdb: 953.87 GiB, 1024209543168 bytes, 2000409264 sectors\r\n\/dev\/sdb1   2048 2000409230 2000407183 953.9G Linux filesystem\r\n<\/pre>\n<h2>PV\u3092\u4f5c\u6210\u3059\u308b\uff01<\/h2>\n<p>\u300c\/dev\/sdb1\u300d\u306bPV\u3092\u4f5c\u6210\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"brush: plain; highlight: [1]; title: ; notranslate\" title=\"\">\r\n# pvcreate \/dev\/sdb1\r\n  Physical volume &quot;\/dev\/sdb1&quot; successfully created.\r\n<\/pre>\n<p>PV\u304c\u4f5c\u6210\u3055\u308c\u305f\u3053\u3068\u3092\u78ba\u8a8d\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"brush: plain; highlight: [1,6,9]; title: ; notranslate\" title=\"\">\r\n# pvs\r\n  PV         VG       Fmt  Attr PSize    PFree   \r\n  \/dev\/sda2  vgubuntu lvm2 a--  &lt;223.07g   16.00m\r\n  \/dev\/sdb1           lvm2 ---  &lt;953.87g &lt;953.87g\r\n# pvscan\r\n  PV \/dev\/sda2   VG vgubuntu        lvm2 &#x5B;&lt;223.07 GiB \/ 16.00 MiB free]\r\n  PV \/dev\/sdb1                      lvm2 &#x5B;&lt;953.87 GiB]\r\n  Total: 2 &#x5B;&lt;1.15 TiB] \/ in use: 1 &#x5B;&lt;223.07 GiB] \/ in no VG: 1 &#x5B;&lt;953.87 GiB]\r\n# pvdisplay\r\n --- Physical volume ---\r\n  PV Name               \/dev\/sda2\r\n  VG Name               vgubuntu\r\n  PV Size               &lt;223.07 GiB \/ not usable 3.00 MiB\r\n  Allocatable           yes \r\n  PE Size               4.00 MiB\r\n  Total PE              57105\r\n  Free PE               4\r\n  Allocated PE          57101\r\n  PV UUID               QAZdy9-MQzI-ZLEz-7gt0-rcbU-FxKi-wELEIc\r\n   \r\n  &quot;\/dev\/sdb1&quot; is a new physical volume of &quot;&lt;953.87 GiB&quot;\r\n  --- NEW Physical volume ---\r\n  PV Name               \/dev\/sdb1\r\n  VG Name               \r\n  PV Size               &lt;953.87 GiB\r\n  Allocatable           NO\r\n  PE Size               0   \r\n  Total PE              0\r\n  Free PE               0\r\n  Allocated PE          0\r\n  PV UUID               a0Pu6z-llHc-mKDh-lFtV-Hdzb-LFC3-WGV6JM\r\n   \r\n<\/pre>\n<h2>VG\u3092\u4f5c\u6210\u3059\u308b\uff01<\/h2>\n<p>VG\u3092\u4f5c\u6210\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"brush: plain; highlight: [1]; title: ; notranslate\" title=\"\">\r\n# vgcreate vgdata01 \/dev\/sdb1\r\n  Volume group &quot;vgdata01&quot; successfully created\r\n<\/pre>\n<p>VG\u304c\u4f5c\u6210\u3055\u308c\u305f\u3053\u3068\u3092\u78ba\u8a8d\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"brush: plain; highlight: [1]; title: ; notranslate\" title=\"\">\r\n# vgs\r\n  VG       #PV #LV #SN Attr   VSize    VFree   \r\n  vgdata01   1   0   0 wz--n- &lt;953.87g &lt;953.87g\r\n  vgubuntu   1   2   0 wz--n- &lt;223.07g   16.00m\r\n# vgscan\r\n  Found volume group &quot;vgdata01&quot; using metadata type lvm2\r\n  Found volume group &quot;vgubuntu&quot; using metadata type lvm2\r\n# vgdisplay\r\n --- Volume group ---\r\n  VG Name               vgdata01\r\n  System ID             \r\n  Format                lvm2\r\n  Metadata Areas        1\r\n  Metadata Sequence No  1\r\n  VG Access             read\/write\r\n  VG Status             resizable\r\n  MAX LV                0\r\n  Cur LV                0\r\n  Open LV               0\r\n  Max PV                0\r\n  Cur PV                1\r\n  Act PV                1\r\n  VG Size               &lt;953.87 GiB\r\n  PE Size               4.00 MiB\r\n  Total PE              244190\r\n  Alloc PE \/ Size       0 \/ 0   \r\n  Free  PE \/ Size       244190 \/ &lt;953.87 GiB\r\n  VG UUID               KIXMEn-Cskw-rHgf-XKRj-ds9M-UTp1-gdDEAT\r\n   \r\n  --- Volume group ---\r\n  VG Name               vgubuntu\r\n  System ID             \r\n  Format                lvm2\r\n  Metadata Areas        1\r\n  Metadata Sequence No  3\r\n  VG Access             read\/write\r\n  VG Status             resizable\r\n  MAX LV                0\r\n  Cur LV                2\r\n  Open LV               2\r\n  Max PV                0\r\n  Cur PV                1\r\n  Act PV                1\r\n  VG Size               &lt;223.07 GiB\r\n  PE Size               4.00 MiB\r\n  Total PE              57105\r\n  Alloc PE \/ Size       57101 \/ 223.05 GiB\r\n  Free  PE \/ Size       4 \/ 16.00 MiB\r\n  VG UUID               Zd0Z6f-t7eu-E1qq-P3Y9-Fl72-kqiI-WImRWT\r\n   \r\n <\/pre>\n<h2>LV\u3092\u4f5c\u6210\u3059\u308b\uff01<\/h2>\n<p>LV\u3092\u4f5c\u6210\u3057\u307e\u3059\u3002VG\u3092\u5168\u3066\u4f7f\u7528\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"brush: plain; highlight: [1]; title: ; notranslate\" title=\"\">\r\n# lvcreate -l 100%Free -n lvdata01 vgdata01\r\n  Logical volume &quot;lvdata01&quot; created.\r\n<\/pre>\n<p>LV\u304c\u4f5c\u6210\u3055\u308c\u305f\u3053\u3068\u3092\u78ba\u8a8d\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"brush: plain; highlight: [1]; title: ; notranslate\" title=\"\">\r\n# lvs\r\n  LV       VG       Attr       LSize    Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert\r\n  lvdata01 vgdata01 -wi-a----- &lt;953.87g                                                    \r\n  root     vgubuntu -wi-ao----  221.14g                                                    \r\n  swap_1   vgubuntu -wi-ao----   &lt;1.91g                                                    \r\nroot@vmsada11:~# lvscan\r\n  ACTIVE            '\/dev\/vgdata01\/lvdata01' &#x5B;&lt;953.87 GiB] inherit\r\n  ACTIVE            '\/dev\/vgubuntu\/root' &#x5B;221.14 GiB] inherit\r\n  ACTIVE            '\/dev\/vgubuntu\/swap_1' &#x5B;&lt;1.91 GiB] inherit\r\nroot@vmsada11:~# lvdisplay\r\n  --- Logical volume ---\r\n  LV Path                \/dev\/vgdata01\/lvdata01\r\n  LV Name                lvdata01\r\n  VG Name                vgdata01\r\n  LV UUID                kV364t-WjHa-6c2M-Twqi-dKY8-tU1c-DHWdKe\r\n  LV Write Access        read\/write\r\n  LV Creation host, time dpc011p1, 2022-12-01 07:08:14 +0900\r\n  LV Status              available\r\n  # open                 0\r\n  LV Size                &lt;953.87 GiB\r\n  Current LE             244190\r\n  Segments               1\r\n  Allocation             inherit\r\n  Read ahead sectors     auto\r\n  - currently set to     256\r\n  Block device           253:2\r\n   \r\n  --- Logical volume ---\r\n  LV Path                \/dev\/vgubuntu\/root\r\n  LV Name                root\r\n  VG Name                vgubuntu\r\n  LV UUID                KT30DZ-bLqP-icnu-YMl6-549J-OUXx-WldWdb\r\n  LV Write Access        read\/write\r\n  LV Creation host, time ubuntu, 2022-11-30 06:38:50 +0900\r\n  LV Status              available\r\n  # open                 1\r\n  LV Size                221.14 GiB\r\n  Current LE             56613\r\n  Segments               1\r\n  Allocation             inherit\r\n  Read ahead sectors     auto\r\n  - currently set to     256\r\n  Block device           253:0\r\n   \r\n  --- Logical volume ---\r\n  LV Path                \/dev\/vgubuntu\/swap_1\r\n  LV Name                swap_1\r\n  VG Name                vgubuntu\r\n  LV UUID                2reU8y-zQBp-hj5o-Fdbq-2L4T-UBxJ-bMsk7u\r\n  LV Write Access        read\/write\r\n  LV Creation host, time ubuntu, 2022-11-30 06:38:50 +0900\r\n  LV Status              available\r\n  # open                 2\r\n  LV Size                &lt;1.91 GiB\r\n  Current LE             488\r\n  Segments               1\r\n  Allocation             inherit\r\n  Read ahead sectors     auto\r\n  - currently set to     256\r\n  Block device           253:1\r\n   \r\n<\/pre>\n<h2>\u30d5\u30a1\u30a4\u30eb\u30b7\u30b9\u30c6\u30e0\u3092\u4f5c\u6210\u3059\u308b\uff01<\/h2>\n<p>ext4\u306e\u30d5\u30a1\u30a4\u30eb\u30b7\u30b9\u30c6\u30e0\u3092\u4f5c\u6210\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"brush: plain; highlight: [1]; title: ; notranslate\" title=\"\">\r\n# mkfs.ext4 \/dev\/vgdata01\/lvdata01\r\nmke2fs 1.46.5 (30-Dec-2021)\r\nDiscarding device blocks: done                            \r\nCreating filesystem with 250050560 4k blocks and 62513152 inodes\r\nFilesystem UUID: 724f865d-c91a-4af9-a041-ade824a51cec\r\nSuperblock backups stored on blocks: \r\n\t32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208, \r\n\t4096000, 7962624, 11239424, 20480000, 23887872, 71663616, 78675968, \r\n\t102400000, 214990848\r\n\r\nAllocating group tables: done                            \r\nWriting inode tables: done                            \r\nCreating journal (262144 blocks): done\r\nWriting superblocks and filesystem accounting information: done     \r\n<\/pre>\n<h2>\u4f5c\u6210\u3057\u305f\u30d5\u30a1\u30a4\u30eb\u30b7\u30b9\u30c6\u30e0\u3092\u30de\u30a6\u30f3\u30c8\u3059\u308b\uff01<\/h2>\n<p>\u4f5c\u6210\u3057\u305f\u30d5\u30a1\u30a4\u30eb\u30b7\u30b9\u30c6\u30e0\u3092\u30de\u30a6\u30f3\u30c8\u3057\u307e\u3059\u3002\u307e\u305a\u3001\u30de\u30a6\u30f3\u30c8\u30dd\u30a4\u30f3\u30c8\u3092\u4f5c\u6210\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\n# mkdir \/var\/local\/data01\r\n<\/pre>\n<p>\u30de\u30a6\u30f3\u30c8\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"brush: plain; highlight: [1]; title: ; notranslate\" title=\"\">\r\n# mount \/dev\/vgdata01\/lvdata01 \/var\/local\/data01\r\n<\/pre>\n<p>\u30de\u30a6\u30f3\u30c8\u3055\u308c\u305f\u3053\u3068\u3092\u78ba\u8a8d\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"brush: plain; highlight: [1]; title: ; notranslate\" title=\"\">\r\n# mount | grep data01\r\n\/dev\/mapper\/vgdata01-lvdata01 on \/var\/local\/data01 type ext4 (rw,relatime)\r\n<\/pre>\n<h2>\u518d\u8d77\u52d5\u5f8c\u3082\u30de\u30a6\u30f3\u30c8\u3059\u308b\uff01<\/h2>\n<p>\u518d\u8d77\u52d5\u5f8c\u3082\u30de\u30a6\u30f3\u30c8\u3059\u308b\u3088\u3046\u306b\u3001\/etc\/fstab\u306b\u8a2d\u5b9a\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"brush: plain; highlight: [1]; title: ; notranslate\" title=\"\">\r\n# vi \/etc\/fstab\r\n...\r\nUUID=&quot;724f865d-c91a-4af9-a041-ade824a51cec&quot; \/var\/local\/data01 ext4 defaults 0 2\r\n<\/pre>\n<p>\u78ba\u8a8d\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"brush: plain; highlight: [1]; title: ; notranslate\" title=\"\">\r\n# umount \/var\/local\/data01\r\n# df -h | grep \/var\/local\/data01\r\n# mount \/var\/local\/data01\r\n# df -h | grep \/var\/local\/data01\r\n\/dev\/mapper\/vgdata01-lvdata01  938G   28K  891G   1% \/var\/local\/data01\r\n<\/pre>\n<p>\u30b5\u30fc\u30d0\u306e\u518d\u8d77\u52d5\u3082\u884c\u3063\u3066\u3001\u30de\u30a6\u30f3\u30c8\u3055\u308c\u308b\u304b\u78ba\u8a8d\u3057\u3066\u304a\u304d\u307e\u3057\u3087\u3046\u3002<\/p>\n<h2>\u304a\u308f\u308a\u306b<\/h2>\n<p>LVM\u306e\u4f5c\u6210\u3068\u30de\u30a6\u30f3\u30c8\u306f\u3001\u9577\u3044\u624b\u9806\u306b\u306f\u306a\u308a\u307e\u3059\u304c\u3001\u30d1\u30fc\u30c6\u30a3\u30b7\u30e7\u30f3\u306e\u4f5c\u6210\u2192PV\u4f5c\u6210\u2192VG\u4f5c\u6210\u2192LV\u4f5c\u6210\u2192\u30d5\u30a1\u30a4\u30eb\u30b7\u30b9\u30c6\u30e0\u4f5c\u6210\u3068\u9806\u756a\u306b\u4f5c\u696d\u3057\u3066\u3044\u3051\u3070\u96e3\u3057\u3044\u3068\u3053\u308d\u306f\u3042\u308a\u307e\u305b\u3093\u3002<\/p>\n<h2>\u95a2\u9023\u8a18\u4e8b<\/h2>\n\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Ubuntu Server\u306b\u30c7\u30fc\u30bf\u7528\u306eLVM\u3092\u8ffd\u52a0\u3057\u307e\u3059\u3002\u4f5c\u696d\u306f\u3001\u7ba1\u7406\u8005\u6a29\u9650\uff08root\u6a29\u9650\uff09\u3067\u884c\u3044\u307e\u3059\u3002<\/p>\n","protected":false},"author":1,"featured_media":5284,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[236],"tags":[653,51,274],"class_list":["post-5571","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-ubuntu-topics","tag-lvm","tag-ubuntu","tag-ubuntu-desktop"],"_links":{"self":[{"href":"https:\/\/lab4ict.com\/system\/wp-json\/wp\/v2\/posts\/5571","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lab4ict.com\/system\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lab4ict.com\/system\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lab4ict.com\/system\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/lab4ict.com\/system\/wp-json\/wp\/v2\/comments?post=5571"}],"version-history":[{"count":3,"href":"https:\/\/lab4ict.com\/system\/wp-json\/wp\/v2\/posts\/5571\/revisions"}],"predecessor-version":[{"id":13748,"href":"https:\/\/lab4ict.com\/system\/wp-json\/wp\/v2\/posts\/5571\/revisions\/13748"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/lab4ict.com\/system\/wp-json\/wp\/v2\/media\/5284"}],"wp:attachment":[{"href":"https:\/\/lab4ict.com\/system\/wp-json\/wp\/v2\/media?parent=5571"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lab4ict.com\/system\/wp-json\/wp\/v2\/categories?post=5571"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lab4ict.com\/system\/wp-json\/wp\/v2\/tags?post=5571"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}