-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathformat.sh
More file actions
38 lines (30 loc) · 1 KB
/
Copy pathformat.sh
File metadata and controls
38 lines (30 loc) · 1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#!/bin/bash
# Universal USB Formatter - Linux, macOS, Windows (via WSL)
echo "💿 Universal USB Formatter"
echo "--------------------------------"
# Root huquqi tekshiruvi
if [ "$EUID" -ne 0 ]; then
echo "❌ Iltimos, skriptni sudo bilan ishga tushiring."
exit 1
fi
# Mavjud disklarni ko‘rsatish
lsblk
echo
read -p "Qaysi diskni formatlamoqchisiz? (masalan: sdb): " DISK
# Tasdiqlash
read -p "⚠️ Diqqat! /dev/$DISK o‘chiriladi. Davom etasizmi? (yes/no): " CONFIRM
if [[ "$CONFIRM" != "yes" ]]; then
echo "❌ Bekor qilindi."
exit 0
fi
# Ajratilgan bo‘limlarni unmount qilish
echo "🔹 Bo‘limlarni ajratilmoqda..."
umount /dev/${DISK}* 2>/dev/null
# GPT jadval yaratish
echo "🔹 GPT jadval yaratilmoqda..."
parted /dev/$DISK --script mklabel gpt
# FAT32 formatlash
echo "🔹 FAT32 (universal) formatlash..."
parted /dev/$DISK --script mkpart primary fat32 1MiB 100%
mkfs.vfat -F 32 -n MY_USB /dev/${DISK}1
echo "✅ Tayyor! Endi USB har qanday tizimda o‘qiladi (Linux / Windows / macOS)."