- 追加された行はこの色です。
- 削除された行はこの色です。
#author("2021-03-12T16:18:22+09:00","default:honma","honma")
#author("2021-03-12T17:14:39+09:00","default:honma","honma")
* 仮想マシンのHDDの増設方法 [#weff04f3]
VMware Playerで、仮想マシンのHDDを増設する方法のメモ
VMware Playerで、仮想マシンのHDDを増設する方法のメモ~
※ゲストOSが ubunntu の場合
** HDDの追加 [#y94d6d37]
仮想マシンにHDDを追加する手順。
+ 仮想マシン設定の編集(D)から「ハードウェア」タブの「追加(A)...」ボタンをクリック。
+ 「ハードウェア追加ウィザード」が表示されるので、「ハードウェアの種類」では「ハードディスク」を選択。
+ 「ディスク タイプの選択」では「SCSI(S) (推奨)」のまま。
+ 「ディスクの選択」では「仮想ディスクの新規作成(V)」を選択。
+ 「ディスク容量の指定」では、任意に設定。
+ 「ディスク ファイルの指定」では、任意のディレクトリに vmdk を作成して「完了」。
** ディスクの確認 [#pbcff1d2]
fdiskコマンドで確認すると「/dev/sdb」が追加されたドライブだとわかる。
$ sudo fdisk -l
Disk /dev/sdb: 20 GiB, 21474836480 bytes, 41943040 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk /dev/sda: 60 GiB, 64424509440 bytes, 125829120 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0xcd164bd0
デバイス 起動 Start 最後から セクタ Size Id タイプ
/dev/sda1 * 2048 125065215 125063168 59.7G 83 Linux
/dev/sda2 125065216 125827071 761856 372M 5 拡張領域
/dev/sda5 125067264 125827071 759808 371M 82 Linux スワップ / Solaris
** パーティションの作成 [#j4362db9]
パーティションを1つ追加する。
$ sudo fdisk /dev/sdb
Welcome to fdisk (util-linux 2.27.1).
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.
Created a new DOS disklabel with disk identifier 0x49de55dd.
コマンド (m でヘルプ): n
Partition type
p primary (0 primary, 0 extended, 4 free)
e extended (container for logical partitions)
Select (default p): p
パーティション番号 (1-4, default 1): 1
First sector (2048-41943039, default 2048):
Last sector, +sectors or +size{K,M,G,T,P} (2048-41943039, default 41943039):
Created a new partition 1 of type 'Linux' and of size 20 GiB.
コマンド (m でヘルプ): w
The partition table has been altered.
Calling ioctl() to re-read partition table.
Syncing disks.
** ディスクの確認(その2) [#d46e5217]
パーティションを追加したことで、fdiskで /dev/sdb1 が追加されたことが確認できる。
$ sudo fdisk -l
Disk /dev/sdb: 20 GiB, 21474836480 bytes, 41943040 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x49de55dd
デバイス 起動 Start 最後から セクタ Size Id タイプ
/dev/sdb1 2048 41943039 41940992 20G 83 Linux
Disk /dev/sda: 60 GiB, 64424509440 bytes, 125829120 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0xcd164bd0
デバイス 起動 Start 最後から セクタ Size Id タイプ
/dev/sda1 * 2048 125065215 125063168 59.7G 83 Linux
/dev/sda2 125065216 125827071 761856 372M 5 拡張領域
/dev/sda5 125067264 125827071 759808 371M 82 Linux スワップ / Solaris
** ファイルシステムの確認 [#r593c73b]
現在、使用中のファイルシステムを確認しておく。
$ df -T
Filesystem Type 1K-blocks Used Available Use% Mounted on
udev devtmpfs 1992168 0 1992168 0% /dev
tmpfs tmpfs 402848 6380 396468 2% /run
/dev/sda1 ext4 61417484 51250292 7024236 88% /
tmpfs tmpfs 2014232 252 2013980 1% /dev/shm
tmpfs tmpfs 5120 4 5116 1% /run/lock
tmpfs tmpfs 2014232 0 2014232 0% /sys/fs/cgroup
vmhgfs-fuse fuse.vmhgfs-fuse 499137532 427050968 72086564 86% /mnt/hgfs
tmpfs tmpfs 402848 72 402776 1% /run/user/1000
** ディスクのフォーマット [#rccb3567]
/dev/sdb1 を ext4でフォーマットする。
$ sudo mkfs.ext4 /dev/sdb1
mke2fs 1.42.13 (17-May-2015)
Creating filesystem with 5242624 4k blocks and 1310720 inodes
Filesystem UUID: ecb66f90-1919-4e33-ba58-3af8b21d909e
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
4096000
Allocating group tables: done
Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done
** ディスクのマウント [#q41557c0]
ディスクをマウントして使用する。~
※マウント先のアクセス権は注意
$ sudo mkdir /mnt/tmp_hdd
$ sudo mount /dev/sdb1 /mnt/tmp_hdd
$ df -T
Filesystem Type 1K-blocks Used Available Use% Mounted on
udev devtmpfs 1992168 0 1992168 0% /dev
tmpfs tmpfs 402848 6384 396464 2% /run
/dev/sda1 ext4 61417484 51250280 7024248 88% /
tmpfs tmpfs 2014232 252 2013980 1% /dev/shm
tmpfs tmpfs 5120 4 5116 1% /run/lock
tmpfs tmpfs 2014232 0 2014232 0% /sys/fs/cgroup
vmhgfs-fuse fuse.vmhgfs-fuse 499137532 427063796 72073736 86% /mnt/hgfs
tmpfs tmpfs 402848 68 402780 1% /run/user/1000
/dev/sdb1 ext4 20510332 44992 19400432 1% /mnt/tmp_hdd
** OS起動時に自動でマウントする場合 [#fc9a8f1c]
OS起動時に自動でマウントする場合は、 /etc/fstab に UUID を追加する。
$ sudo blkid /dev/sdb1
/dev/sdb1: UUID="ecb66f90-1919-4e33-ba58-3af8b21d909e" TYPE="ext4" PARTUUID="49de55dd-01"
$ sudo nano /etc/fstab
UUID=ecb66f90-1919-4e33-ba58-3af8b21d909e /mnt/tmp_hdd ext4 defaults 0 0
追加前の状態
追加前の状態はこんな感じ
$ cat /etc/fstab
# /etc/fstab: static file system information.
#
# Use 'blkid' to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name devices
# that works even if disks are added and removed. See fstab(5).
#
# <file system> <mount point> <type> <options> <dump> <pass>
# / was on /dev/sda1 during installation
UUID=18263217-3d19-4d6f-be64-10dfe87dd017 / ext4 errors=remount-ro 0 1
# swap was on /dev/sda5 during installation
UUID=c3aa15ec-7b09-4eef-a69c-d497d656eb02 none swap sw 0 0
#htmlinsert(amazon_pc.html);