[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Please check my sudo bash script



On 2025-08-31, Tom Browder <tom.browder@gmail.com> wrote:
>
> Does this bash fragment look safe for using bash vars for the first disk:
>
> SDX=sda
> sudo parted /dev/${SDX} mklabel gpt
> sudo parted -a opt /dev/${SDX} mkpart primary ext4=0% 100%
> sudo mkfs.ext4 /dev/${SDX}

The mkfs step must target the partition, not the disk.  Formatting the
raw disk (/dev/sda) after creating a partition table means you’re
ignoring the table you just wrote, effectively making the partition
table useless.

> Thanks.
>
> -Tom
>
>


Reply to: