Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- sfdisk CLI non-interactive method
- echo 'start=2048, type=83' | sudo sfdisk /dev/sdX
- sudo mkfs.ext4 /dev/sdX1
- erases all data, and creates a single partition that takes up all USB with an ext4 filesystem.
- Choose X based on the output of:
- sudo lsblk
- sudo fdisk -l
- For more detailed description of sfdisk see: https://superuser.com/questions/332252/creating-and-formating-a-partition-using-a-bash-script/1132834#1132834
- fdisk automation
- It is also possible to do the same as above with:
- printf 'o\nn\np\n1\n\n\nw\n' | sudo fdisk /dev/sdX
- but this method is less maintainable than sfdisk, which was designed for Scripting fdisk, specially if you want to create more complex partition tables.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement