ゲストOSを停止させて、HDDを追加。停止させないと認識しないので注意。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# fdisk -l Disk /dev/sda: 17.2 GB, 17179869184 bytes, 33554432 sectors Units = sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O サイズ (最小 / 推奨): 512 バイト / 512 バイト Disk label type: dos ディスク識別子: 0x000b4aab デバイス ブート 始点 終点 ブロック Id システム /dev/sda1 * 2048 1026047 512000 83 Linux /dev/sda2 1026048 33554431 16264192 8e Linux LVM Disk /dev/sdb: 268.4 GB, 268435456000 bytes, 524288000 sectors Units = sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O サイズ (最小 / 推奨): 512 バイト / 512 バイト Disk /dev/mapper/centos-root: 14.9 GB, 14889779200 bytes, 29081600 sectors Units = sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O サイズ (最小 / 推奨): 512 バイト / 512 バイト Disk /dev/mapper/centos-swap: 1719 MB, 1719664640 bytes, 3358720 sectors Units = sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O サイズ (最小 / 推奨): 512 バイト / 512 バイト |
/dev/sdbが新しいディスク。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
# fdisk /dev/sdb Welcome to fdisk (util-linux 2.23.2). Changes will remain in memory only, until you decide to write them. Be careful before using the write command. Device does not contain a recognized partition table Building a new DOS disklabel with disk identifier 0x79dd4323. コマンド (m でヘルプ): m コマンドの動作 a ブート可能フラグをつける b bsd ディスクラベルを編集する c dos 互換フラグをつける d 領域を削除する l 既知の領域タイプをリスト表示する m このメニューを表示する n 新たに領域を作成する o 新たに空の DOS 領域テーブルを作成する p 領域テーブルを表示する q 変更を保存せずに終了する s 空の Sun ディスクラベルを作成する t 領域のシステム ID を変更する u 表示/項目ユニットを変更する v 領域テーブルを照合する w テーブルをディスクに書き込み、終了する x 特別な機能 (エキスパート専用) コマンド (m でヘルプ): n Partition type: p primary (0 primary, 0 extended, 4 free) e extended Select (default p): p パーティション番号 (1-4, default 1): 1 最初 sector (2048-524287999, 初期値 2048): 初期値 2048 を使います Last sector, +sectors or +size{K,M,G} (2048-524287999, 初期値 524287999): 初期値 524287999 を使います Partition 1 of type Linux and of size 250 GiB is set コマンド (m でヘルプ): p Disk /dev/sdb: 268.4 GB, 268435456000 bytes, 524288000 sectors Units = sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O サイズ (最小 / 推奨): 512 バイト / 512 バイト Disk label type: dos ディスク識別子: 0xfefe0aee デバイス ブート 始点 終点 ブロック Id システム /dev/sdb1 2048 524287999 262142976 83 Linux |
wで保存。
1 2 3 4 5 6 |
コマンド (m でヘルプ): w パーティションテーブルは変更されました! ioctl() を呼び出してパーティションテーブルを再読込みします。 ディスクを同期しています。 |
1 2 3 4 5 6 7 8 9 10 11 |
# fdisk -l Disk /dev/sdb: 268.4 GB, 268435456000 bytes, 524288000 sectors Units = sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O サイズ (最小 / 推奨): 512 バイト / 512 バイト Disk label type: dos ディスク識別子: 0xfefe0aee デバイス ブート 始点 終点 ブロック Id システム /dev/sdb1 2048 524287999 262142976 83 Linux |
物理ボリュームをつくる。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
# pvcreate /dev/sdb1 Physical volume "/dev/sdb1" successfully created # pvdisplay "/dev/sdb1" is a new physical volume of "250.00 GiB" --- NEW Physical volume --- PV Name /dev/sdb1 VG Name PV Size 250.00 GiB Allocatable NO PE Size 0 Total PE 0 Free PE 0 Allocated PE 0 PV UUID z19uM4-SLsC-sWj3-XzpS-fcXr-aPUa-wsgME0 |
ボリュームグループを作る。
1 2 |
# vgcreate -s32m VG_samba /dev/sdb1 Volume group "VG_samba" successfully created |
論理ボリュームを作る。
1 2 |
# lvcreate -l 100%FREE -n LV_samba VG_samba Logical volume "LV_samba" created. |
ファイルシステムを作る。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# mkfs.ext4 /dev/VG_samba/LV_samba mke2fs 1.42.9 (28-Dec-2013) Filesystem label= OS type: Linux Block size=4096 (log=2) Fragment size=4096 (log=2) Stride=0 blocks, Stripe width=0 blocks 16384000 inodes, 65527808 blocks 3276390 blocks (5.00%) reserved for the super user First data block=0 Maximum filesystem blocks=2214592512 2000 block groups 32768 blocks per group, 32768 fragments per group 8192 inodes per group Superblock backups stored on blocks: 32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208, 4096000, 7962624, 11239424, 20480000, 23887872 Allocating group tables: done Writing inode tables: done Creating journal (32768 blocks): done Writing superblocks and filesystem accounting information: done |
マウントする。
1 |
# mount -t ext4 -o defaults /dev/VG_samba/LV_samba /samba/share |
自動起動設定。
1 2 |
# vi /etc/fstab /dev/mapper/VG_samba-LV_samba /samba/share ext4 defaults 0 0 |