if [[ $1 == [Tt][Rr][Uu][Ee] ]]; then
        physical_disk_num=`lsblk --output NAME,TYPE |grep disk |wc -l`
        if [[ $physical_disk_num -gt 1 ]];then
                echo "There is an extra disk. The extra disk will be formatted."
                system_disk_partition=`findmnt -n -o SOURCE --target /`
                readarray -t physical_disk <<< `lsblk --output NAME,TYPE |grep disk|awk '{print $1}'`
                extra_disk=()
                for item in "${physical_disk[@]}"; do
                        res=$(echo $system_disk_partition | grep "${item}")
                        if [[ "$res" == "" ]];then
                                extra_disk+=("$item")
                        fi
                done

                extra_block_device=()
                for device in "${extra_disk[@]}"; do
                        block_device="/dev/$device"
                        extra_block_device+=("$block_device")
                done

                no_mounted_block_device=()
                for block_device in "${extra_block_device[@]}"; do
                        if  mount |grep $block_device ; then
                                echo "$block_device has been mounted"
                        else
                                no_mounted_block_device+=("$block_device")
                        fi
                done

                over_4t_size_device=()
                less_4t_size_device=()
                for block_device in "${no_mounted_block_device[@]}"; do
                    sector_size=$(blockdev --getsz $block_device)
                    if  (( sector_size > 4294967295 )); then
                        over_4t_size_device+=("$block_device")
                    else
                        less_4t_size_device+=("$block_device")
                    fi
                done
                echo "Over 4T size disk: ${over_4t_size_device[@]}"
                echo "Less 4T size disk: ${less_4t_size_device[@]}"

                for blockdevice in "${less_4t_size_device[@]}"; do
                        echo "Prepare To Format The Disk $blockdevice"
                        wipefs -a $blockdevice
                        parted $blockdevice mklabel msdos
                        parted $blockdevice mkpart primary 0% 100%
                        device_part=$(fdisk -l $blockdevice | awk '/^\/dev/ {devices = devices $1 "\n"} END {printf "%s", devices}')
                        device_part_length=${#device_part[@]}
                        if (( $device_part_length == 1 )); then
                                first_part=${device_part[0]}
                                echo "There is one partition, preparing to format the disk partition ${first_part}."
                                mkfs.ext4 -F ${first_part}
                                mountdata_dir="/${blockdevice#/dev/}-disk"
                                mkdir ${mountdata_dir}
                                mount ${first_part} ${mountdata_dir}
                                echo "${first_part} ${mountdata_dir} ext4 defaults 0 0" >> /etc/fstab
                        fi
                done


                for blockdevice in "${over_4t_size_device[@]}"; do
                        echo "Prepare To Format The Disk $blockdevice"
                        wipefs -a $blockdevice
                        parted $blockdevice mklabel gpt
                        parted $blockdevice mkpart primary 0% 100%
                        device_part=$(fdisk -l $blockdevice | awk '/^\/dev/ {devices = devices $1 "\n"} END {printf "%s", devices}')
                        device_part_length=${#device_part[@]}
                        if (( $device_part_length == 1 )); then
                                first_part=${device_part[0]}
                                echo "There is one partition, preparing to format the disk partition ${first_part}."
                                mkfs.ext4 -F ${first_part}
                                mountdata_dir="/${blockdevice#/dev/}-disk"
                                mkdir ${mountdata_dir}
                                mount ${first_part} ${mountdata_dir}
                                echo "${first_part} ${mountdata_dir} ext4 defaults 0 0" >> /etc/fstab
                        fi
                done

                send_message=""
                # check disk format
                for blockdevice in "${extra_block_device[@]}"; do
                    mountdata_dir="/${blockdevice#/dev/}-disk"
                    if findmnt $mountdata_dir &> /dev/null; then
                        if [ $(find $mountdata_dir -mindepth 1 -maxdepth 1 -not -name 'lost+found' | wc -l) -eq 0 ]; then
                            echo "The file system is empty."
                        else
                            message="$mountdata_dir is not empty."
                            send_message+=$message
                            echo "The file system $mountdata_dir contains files or directories."
			    exit 1
                        fi
                    else
                        message="$mountdata_dir is not mounted."
                        send_message+=$message
                        echo "Disk data directory $mountdata_dir mount error."
			exit 1
                    fi
                done
        fi
fi


