handle nvme drives when using ext4

This commit is contained in:
Michael Schmid 2023-09-05 15:57:11 -04:00
parent 882d99a6ec
commit 0b1e6fb9ac

View File

@ -717,6 +717,11 @@ if [ "$1" = "format" ]; then
# formatting old: EXT4
if [ "$2" = "ext4" ]; then
if [ $(echo "${hdd}" | grep -c "nvme") = 0 ]; then
nvp=""
else
nvp="p"
fi
# prepare temp mount point
mkdir -p /tmp/ext4 1>/dev/null
if [ $ext4IsPartition -eq 0 ]; then
@ -733,7 +738,7 @@ if [ "$1" = "format" ]; then
>&2 echo "# waiting until the partition gets available"
sleep 2
sync
loopdone=$(lsblk -o NAME | grep -c ${hdd}1)
loopdone=$(lsblk -o NAME | grep -c ${hdd}${nvp}1)
loopcount=$(($loopcount +1))
if [ ${loopcount} -gt 10 ]; then
>&2 echo "# partition failed"
@ -754,7 +759,7 @@ if [ "$1" = "format" ]; then
fi
>&2 echo "# Formatting"
if [ $ext4IsPartition -eq 0 ]; then
mkfs.ext4 -F -L BLOCKCHAIN /dev/${hdd}1 1>/dev/null
mkfs.ext4 -F -L BLOCKCHAIN /dev/${hdd}${nvp}1 1>/dev/null
else
mkfs.ext4 -F -L BLOCKCHAIN /dev/${hdd} 1>/dev/null
fi