Last active
April 16, 2025 16:55
-
-
Save nero-dv/659b6d85d7fa3806ce89fc4811375d3c to your computer and use it in GitHub Desktop.
Formatting an external drive and starting clean with a GPT partition table. If you run: sudo mkfs.ext4 /dev/sdb, you're formatting the entire raw device as an ext4 without any partition table. This is okay in some specific situations, but generally not recommended for general purpose storage.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
read -p "Enter drive path (ex: /dev/sdb): " drivepath | |
# wipe all partitions on 'drivepath' | |
sudo wipefs -a $drivepath | |
# create a gpt partition table, ext4 partition | |
sudo parted $drivepath mklabel gpt | |
sudo parted -a opt $drivepath mkpart primary ext4 0% 100% | |
sudo mkfs.ext4 drivepath\1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment