You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Windows下无需第三方软件,命令行/脚本格式化SD卡为EXT4的方法问询

Alright, let's tackle this problem directly: Windows' native format command doesn't support EXT4 out of the box, which is exactly what you're hitting. But don't worry—there's a way to do this without installing third-party software, using tools that are already built into modern Windows 10/11.

Method 1: Use Windows Subsystem for Linux (WSL)

WSL is a built-in Windows feature that lets you run a Linux environment directly on Windows, and it gives you access to Linux's native disk tools like mkfs.ext4—perfect for formatting your SD card for a Linux device.

Step 1: Enable WSL (if not already set up)

Open PowerShell as Administrator and run this command to install WSL and a default Linux distro (like Ubuntu):

wsl --install

You'll need to restart your PC after the installation finishes.

Step 2: Identify your SD card in Windows

First, confirm which disk is your SD card to avoid accidentally formatting your system drive:

  1. Open Command Prompt or PowerShell as Administrator and run:
    diskpart
    
  2. List all connected disks:
    list disk
    
  3. Look for your SD card (it'll usually be smaller than your internal drive, and marked as "Removable"). Note its disk number (e.g., Disk 2).
  4. Exit DiskPart:
    exit
    

Step 3: Format the SD card via WSL

  1. Launch your WSL distro (e.g., Ubuntu) from the Start Menu.
  2. First, identify the SD card's device path in WSL. Run:
    lsblk
    
    Your SD card will show up as /dev/sdX (e.g., /dev/sdb if it was Disk 2 in Windows). Double-check the size to be sure.
  3. Unmount any mounted partitions on the SD card (to avoid errors):
    sudo umount /dev/sdX*
    
    Replace sdX with your actual device letter (e.g., sdb).
  4. Format the entire SD card as EXT4:
    sudo mkfs.ext4 /dev/sdX
    
    Or, if you only want to format a specific partition (e.g., the first partition):
    sudo mkfs.ext4 /dev/sdX1
    
  5. When prompted, type y to confirm the format (this will erase all data on the card, so make sure you've backed up anything important!).
Bonus: Prep the partition with DiskPart first (optional)

If you want to create a Linux-specific partition first using Windows' native DiskPart, you can do this before formatting via WSL:

  1. Follow Step 2 above to select your SD card in DiskPart.
  2. Clean all existing partitions on the card:
    clean
    
  3. Create a primary partition:
    create partition primary
    
  4. Set the partition type to Linux (ID 83):
    set id=83
    
  5. Exit DiskPart, then jump back to Step 3 in the WSL method to format the partition as EXT4.

Important Notes:

  • Always verify the disk/device path twice—formatting the wrong drive will erase all data irrecoverably.
  • WSL requires administrative access to interact with physical disks, so you'll need to use sudo in the Linux commands.

内容的提问来源于stack exchange,提问作者lquasar

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.20 12:04:43