16GBで構築したLinux Mintですが、Androidの開発環境を構築していったところ足りなくなってしまった為、
ディスクの容量を32GBに増やしてみました。
■環境
Linux Mint 12
VirtualBox 4.1.14
gparted
■前提条件
VirtualBoxで対象のVMにスナップショットが存在しないこと。
(参考資料:元うなぎ屋: VirtualBox HDD (VDI) 拡張 出来なかった(解決))
まずはじめに、「VBoxManage modifyhd」コマンドでディスクサイズを変更します。
(「VBoxManage modifyhd」の詳細は他のサイトでも紹介されてるので省略します。)
C:\Users\t.sato\VirtualBox VMs\linuxmint-12-gnome-dvd-64bit>VBoxManage modifyhd linuxmint-12-gnome-dvd-64bit.vdi --resize 32768 0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100%
VirtualBoxの設定画面で、「仮想的なサイズ」が「32.00GB」に変更されていることを確認します。
パーティションの移動と拡張を行います。
下記より「gparted-live-0.12.1-5.iso」をダウンロードしてきます。
http://gparted.sourceforge.net/download.php
ダウンロードしてきた「gparted-live-0.12.1-5.iso」をVirtualBoxのIDEコントローラに指定し、
「gparted-live-0.12.1-5.iso」から起動するようにします。
「パーティションの移動と拡張」まではこちらでご紹介されている内容と同じです。
【Ubuntu】Virtualbox の仮想ハードディスクの容量を増やす方法:なんでもかんでもコンピュータ:So-netブログ
ここからは自己流でswap領域を認識させていきます。
こちらからヒントを得ました。
Ubuntu日本語フォーラム / LINUXーSWAP領域変更?
(ちょっとこの方法が正しいのか怪しいですが、とりあえず認識できたのでメモとして残します。)
ひとまずパーティションの設定を保存し、「gparted」を終了します。
次に、「Linux Mint」を起動します。
この時点では、swap領域は認識されていません。
「top」コマンド「swapon -s」コマンドで確認した結果です。
「/etc/fstab」の修正をします。
$ sudo vi /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> proc /proc proc nodev,noexec,nosuid 0 0 # / was on /dev/sda1 during installation UUID=592cc8f3-b890-4fb6-a97d-5bb7e78df61d / ext4 errors=remount-ro 0 1 # swap was on /dev/sda5 during installation UUID=067da85e-9e71-4f42-b199-1580f38cf4e4 none swap sw 0 0
上記swap部分をコメントアウトし、
「sudo blkid」コマンドで表示されたUUIDに書き換えました。
$ sudo blkid [sudo] password for android: /dev/sda1: UUID="592cc8f3-b890-4fb6-a97d-5bb7e78df61d" TYPE="ext4" /dev/sda5: UUID="24968e7d-392e-405d-ac88-f59cea097d27" TYPE="swap"
変更後、「/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> proc /proc proc nodev,noexec,nosuid 0 0 # / was on /dev/sda1 during installation UUID=592cc8f3-b890-4fb6-a97d-5bb7e78df61d / ext4 errors=remount-ro 0 1 # swap was on /dev/sda5 during installation #UUID=067da85e-9e71-4f42-b199-1580f38cf4e4 none swap sw 0 0 UUID=24968e7d-392e-405d-ac88-f59cea097d27 none swap sw 0 0
Linux Mintを再起動し、「top」コマンド「swapon -s」コマンドで確認したところ
swap領域が認識されているようです。