1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

LinuxでVHDを使うための手順

Posted at

1. 必要なツールのインストール

sudo apt-get install qemu-utils

このコマンドは、VHDファイルを作成し、管理するために必要なqemu-utilsをインストールします。

2. VHDファイルの作成

qemu-img create -f vpc /path/to/new.vhd 10G

ここで、-f vpcオプションはVHDファイルフォーマットを指定し、/path/to/new.vhdはファイルの保存場所と名前、10Gはファイルサイズです。

3. nbd モジュールのロード

sudo modprobe nbd max_part=8

このコマンドは、nbdカーネルモジュールをロードし、最大8個のパーティションをサポートするように設定します。

4. VHDファイルをネットワークブロックデバイスとして接続

sudo qemu-nbd --connect=/dev/nbd0 /path/to/new.vhd

これで、VHDファイルが/dev/nbd0としてシステムに接続されます。

5. ファイルシステムのフォーマット

パーティション分けを行わず、直接デバイスにファイルシステムを作成します。

sudo mkfs.ext4 /dev/nbd0

このコマンドは、/dev/nbd0にext4ファイルシステムを作成します。

6. パーティションのマウント

フォーマットが完了したら、デバイスをマウントします。

sudo mount /dev/nbd0 /mnt

これで、マウントポイント/mntを通じてVHDファイルの内容にアクセスできるようになります。

7. 使用後の後片付け

作業が完了したら、マウントを解除し、デバイスの接続を解除します。

sudo umount /mnt
sudo qemu-nbd --disconnect /dev/nbd0

これらの手順に従うことで、VHDファイル全体を一つのパーティションとして扱い、ファイルシステムを作成し、マウントすることが可能です。

1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?