This is the relevant part for /dev/sdc
So yes, you’ve theoretically successfully created filesystems there. But it’s not clear, just from reading the script, that that you actually have created filesystems there, since your scripts don’t exit on failure of any particular line. Even your steps that create the mount points are vulnerable to failure if any stage has already created the directories: they’re not safely idempotent. there is also no point to creating the partitions, since you’re not using them for anything. You’re running mkfs.ext4 against the raw disk at /dev/sdc, not the partition at /dev/sdc1 which you created with the “mkpart primary” command.
If I may encourage you, spend some time writing a small subroutine, or module, that can check whether the filesystem is already mounted correctly, and if not creates the relevant filesystems and mountpoints safely. And if all you want to do is check the mount is done correctly, do a lightweight shell command: And not the witespace after the “/data/2”, to ensure the correct mountpoint.
- grep '/dev/sdc /data/2 ’ /etc/mtab