#Oracle Virtual Box #ubuntu #ストレージ #拡張
Oracle Virtual Box 上に作っているubuntuのストレージ領域が足りなくなってしまったため、拡張してみました。
確認したOS・ソフトのバージョン
Windows 10 Pro 1903(OSビルド 18362.752)
Oracle Virtual Box 6.0.20 r137117 (Qt5.6.2)
手順
まず、仮想マシンを起動していた場合は、停止させます。
そして、メニューのファイルを選択します。
![](https://i0.wp.com/pasopet.com/wp-content/uploads/2020/06/1-2.jpg?resize=799%2C381&ssl=1)
仮想メディアマネージャーを選択します。
![](https://i0.wp.com/pasopet.com/wp-content/uploads/2020/06/2-3.jpg?resize=300%2C299&ssl=1)
対象の仮想マシンのvdiファイルのサイズを確認します。
vdiファイルが親子関係で2つあります。
まずは、親側を拡張します。
ここでは、10GB => 20GBに拡張しました。
![](https://i0.wp.com/pasopet.com/wp-content/uploads/2020/06/3-2.jpg?resize=637%2C432&ssl=1)
次に子側も10GB => 20GBに拡張します。
![](https://i0.wp.com/pasopet.com/wp-content/uploads/2020/06/4-2.jpg?resize=637%2C432&ssl=1)
これで、Virtual Box側のストレージ領域の拡張は終わりました。
次に、ゲストOSのubuntu側ですが、ubuntuはストレージが拡張されたことをまだ検知していませんし、パーティションサイズを増やしていません。
そのため、これらを以降で行います。
まず、仮想マシンを起動します。
左下部分をクリックします。
![](https://i0.wp.com/pasopet.com/wp-content/uploads/2020/06/5-2.jpg?resize=800%2C642&ssl=1)
下記の画面になるので、検索メガネのところで、”gparted”と入力します。
![](https://i0.wp.com/pasopet.com/wp-content/uploads/2020/06/6-2.jpg?resize=800%2C642&ssl=1)
パーティションを操作できるツール”GParted”のインストールを行います。
“install”をクリックします。
![](https://i0.wp.com/pasopet.com/wp-content/uploads/2020/06/7-2.jpg?resize=800%2C642&ssl=1)
ubuntuの管理者のパスワードをきかれるので、入力します。
![](https://i0.wp.com/pasopet.com/wp-content/uploads/2020/06/8-2.jpg?resize=800%2C642&ssl=1)
インストールが終わったら下記画面になります。
“Launch”をクリックして起動します。
![](https://i0.wp.com/pasopet.com/wp-content/uploads/2020/06/9.jpg?resize=800%2C642&ssl=1)
また、ubuntuの管理者パスワードをきかれるので、入力します。
![](https://i0.wp.com/pasopet.com/wp-content/uploads/2020/06/10.jpg?resize=800%2C642&ssl=1)
下記画面が表示されました。
小生の環境では、10GBだったところに10GBを追加したため、未割当て領域(unallocated)が10GB見えています。割り当て済み領域を選択して、”→|” のボタンをクリックします。
![](https://i0.wp.com/pasopet.com/wp-content/uploads/2020/06/11.jpg?resize=800%2C642&ssl=1)
下記が表示されるので、真ん中の▶を右に引っ張るか、New sizeのところを変更して拡張させます。
![](https://i0.wp.com/pasopet.com/wp-content/uploads/2020/06/12.jpg?resize=800%2C642&ssl=1)
Resizeを押すと、下記のように”Are you sure you want to apply the pending operations?” = 本当に保留している操作を適用しますか?
ときかれます。
“Apply”を押します。
![](https://i0.wp.com/pasopet.com/wp-content/uploads/2020/06/13.jpg?resize=800%2C642&ssl=1)
これで、ようやく下記画面となり、パーティションの拡張が行われます。
![](https://i0.wp.com/pasopet.com/wp-content/uploads/2020/06/14.jpg?resize=800%2C642&ssl=1)
端末を起動して “df -h” を実行すると、 “/” が10GB 47%となっていて、拡張されていることが分かります。
![](https://i0.wp.com/pasopet.com/wp-content/uploads/2020/06/15.jpg?resize=800%2C642&ssl=1)
最後に
古いVirtual Boxなのかもしれませんが、コマンドで拡張する方法がいくつか見つかったので、その方法を試しました。
これでも成功しましたが、今回のようにコマンドを使わなくても実行できることが分かったため、執筆しています。
参考になれば幸いです。
コメント