wsl:: wsl install / delete / move(export)

 

설치가능한 wsl list 확인

wsl -l -o

 

 

 

# 설치
wsl --install -d Ubuntu-22.04

 

 

 

 

설치 중 아래 에러 발생시 관련글 참고

Error: 0x800701bc WSL

https://thekkom.tistory.com/204

 

 


설치된 항목에서 특정이름의 < Distribution Name >을 삭제할 때

wsl --unregister Ubuntu
wsl --unregister Ubuntu-22.04

 

 

 

 


https://woshub.com/move-wsl-another-drive-windows/

 

Moving WSL to Another Drive in Windows | Windows OS Hub

Windows Subsystem for Linux (WSL2) is widely used by developers, administrators, and common users to run different Linux distros (Ubuntu, Debian, OpenSUSE, Kali Linux, Alpine), tools, and apps in Windows…

woshub.com

 

 

 

https://blog.iany.me/2020/06/move-wsl-to-another-drive/

 

Move WSL to Another Drive

Following example moves the Ubuntu distribution to disk D:\WSL\Ubuntu.

blog.iany.me

 

wsl은 기본적으로 c drive에 설치되고 VM형태로 존재하는 듯.

- 그래서 포맷을 할 때 백업하거나

- 용량 때문에 D:\ drive로 옮겨서 사용할 때가 필요함.

   (vscode -  .devcontainer를 사용하려면 wsl내 docker설치가 되어 있어야 함 >> 이것저것 생각하면 vhd로 export하는 게 편함)

 

 

c drive에서 옮기기 위해, vhdx 1개파일로 export하는 과정, 윈도우 terminal에서 실행

WSL2

cd D:\
mkdir WSL
cd WSL
mkdir Ubuntu
wsl --export Ubuntu .\Ubuntu\ext4.vhdx --vhd
wsl --unregister Ubuntu
wsl --import-in-place Ubuntu .\Ubuntu\ext4.vhdx



# check DefaultUid - 1000 (3e8 as Hex)
# HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Lxss

 

 

WSL1 

cd D:\
mkdir WSL
cd WSL
wsl --export Ubuntu ubuntu.tar
wsl --unregister Ubuntu
mkdir Ubuntu
wsl --import Ubuntu Ubuntu ubuntu.tar

 

 

 

 

 

 

 

 

 

_

반응형