Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- # Fix's some issues with hard drives not mounting.
- # List all drives and extract drive paths
- drive_paths=($(lsblk -o NAME -n -p -l))
- # Display the available drives for selection
- echo "Available drives:"
- for ((i=0; i<${#drive_paths[@]}; i++)); do
- echo "[$i] ${drive_paths[i]}"
- done
- # Prompt user to select a drive
- read -p "Enter the number of the drive you want to fix: " drive_number
- # Validate user input
- if ! [[ $drive_number =~ ^[0-9]+$ ]] || [ $drive_number -ge ${#drive_paths[@]} ]; then
- echo "Invalid drive number selected. Exiting..."
- exit 1
- fi
- selected_drive=${drive_paths[drive_number]}
- # Display information
- echo "Selected drive: $selected_drive"
- # Prompt for confirmation
- read -p "Press Enter to continue..."
- # Run sudo ntfsfix on the selected drive
- sudo ntfsfix $selected_drive
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement