bash - Formatting multiple USB sticks in Linux -


i'm trying write program in bash format 7 usb sticks @ once , create new partition each usb stick. problem usb sticks varying makes , models , sizes , need find size of available space on stick , create partition size.

this 1 create filesystems still doesn't partition them before creating. save script script.sh

#!/bin/bash  command=("mkfs.ext4" "-option1" "-option2")  ## change depending on formatting tool you'll use.  dev;     echo "creating filesystem $d."     read -p "continue? " && [[ $reply == [yy] ]] || break  ## remove line if don't want confirm.     "${command[@]}" "$dev" done 

and run bash script.sh /dev/yourdevice1 [/dev/yourdevice2]

example:

bash script.sh /dev/sdc /dev/sdd1

be careful , check arguments before running script.


Comments

Popular posts from this blog

ios - UICollectionView Self Sizing Cells with Auto Layout -

node.js - ldapjs - write after end error -

DOM Manipulation in Wordpress (and elsewhere) using php -