0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

仮想ハードディスクをWSLで利用する。

0
Posted at

概要

Q. WSLで扱うデータを別ドライブに保存するためにはどうすればよいの?
A. 別ドライブに作成した仮想ハードディスクをWSLにマウントする。

手順

  1. [Windows]仮想ハードディスクの作成
    Windowsの「ディスクの管理」→ 「操作」→ 「VHDの作成」

  2. [Windows]仮想ハードディスクをWSLにアタッチ
    Powershellで下記コマンドを実行

    wsl --mount --vhd "X:\hoge.vhdx" --bare
    
  3. [WSL/Linux]仮想ハードディスクのフォーマット
    WSL上のLinuxを起動し、下記コマンドを実行

    # 対象のデバイスファイルを確認
    lsblk -f
    # ext4でフォーマット
    sudo mkfs.ext4 /dev/sdX
    
  4. [WSL/Linux]仮想ハードディスクをマウント

    # 対象のデバイスファイルを適当なディレクトリにマウント
    sudo mount /dev/sdX /hoge/fuga
    # 必要であればディレクトリの所有者を変更
    sudo chown user:user /hoge/fuga
    
0
0
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
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?