Merge pull request #4152 from Schnitzel/dev

handle nvme drives when using ext4
This commit is contained in:
/rootzoll 2023-09-09 19:49:51 +02:00 committed by GitHub
commit e670e61297
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

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