Skip to content

Commit

Permalink
Update resize.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
ehsan6sha committed Apr 15, 2024
1 parent 73b750a commit 9622cda
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions docker/fxsupport/linux/resize.sh
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,10 @@ format_storage_devices() {
echo "The device $DEVICE does not exist." 2>&1 | sudo tee -a $FULA_LOG_PATH
continue # Skip to the next device
fi
sudo docker stop fula_go 2>&1 | sudo tee -a $FULA_LOG_PATH | true
sudo docker stop fula_node 2>&1 | sudo tee -a $FULA_LOG_PATH | true
sudo docker stop ipfs_cluster 2>&1 | sudo tee -a $FULA_LOG_PATH | true
sudo docker stop ipfs_host 2>&1 | sudo tee -a $FULA_LOG_PATH | true
PARTITIONS=$(sudo fdisk -l "$DEVICE" | grep "^${DEVICE}[0-9]*")
if [ -z "$PARTITIONS" ] || [ "$force" -eq 1 ]; then
echo "The device $DEVICE is not formatted or force format is requested. Formatting now..." 2>&1 | sudo tee -a $FULA_LOG_PATH
Expand Down Expand Up @@ -149,11 +153,11 @@ format_storage_devices() {
fi
DEVICE_PATH=$(basename "${DEVICE}${PARTITION_SUFFIX}")
echo "The device $DEVICE is not formatted. Formatting now..." 2>&1 | sudo tee -a $FULA_LOG_PATH
sudo umount "/media/pi${DEVICE_PATH}" 2>&1 | sudo tee -a $FULA_LOG_PATH | true
sudo umount "/media/pi/${DEVICE_PATH}" 2>&1 | sudo tee -a $FULA_LOG_PATH | true
sudo sfdisk --delete "$DEVICE" 2>&1 | sudo tee -a $FULA_LOG_PATH
sudo parted --script "$DEVICE" mklabel gpt 2>&1 | sudo tee -a $FULA_LOG_PATH
sudo parted -a optimal "$DEVICE" mkpart primary ext4 "0%" "100%" 2>&1 | sudo tee -a $FULA_LOG_PATH
sudo umount "/media/pi${DEVICE_PATH}" 2>&1 | sudo tee -a $FULA_LOG_PATH | true
sudo umount "/media/pi/${DEVICE_PATH}" 2>&1 | sudo tee -a $FULA_LOG_PATH | true
sudo mkfs.ext4 -F "${DEVICE}${PARTITION_SUFFIX}" 2>&1 | sudo tee -a $FULA_LOG_PATH
echo "The device $DEVICE has been formatted."

Expand Down

0 comments on commit 9622cda

Please sign in to comment.