Skip to content

Instantly share code, notes, and snippets.

@cosminpopescu14
Created March 21, 2021 08:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cosminpopescu14/34bdc1a87f84cc8628d36dfab261c9c0 to your computer and use it in GitHub Desktop.
Save cosminpopescu14/34bdc1a87f84cc8628d36dfab261c9c0 to your computer and use it in GitHub Desktop.
Fix a USB stick
cosmin@pop-os:~$ sudo fdisk /dev/sda
Welcome to fdisk (util-linux 2.36).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.
Device does not contain a recognized partition table.
Created a new DOS disklabel with disk identifier 0xfd679ce9.
Command (m for help): m
Help:
DOS (MBR)
a toggle a bootable flag
b edit nested BSD disklabel
c toggle the dos compatibility flag
Generic
d delete a partition
F list free unpartitioned space
l list known partition types
n add a new partition
p print the partition table
t change a partition type
v verify the partition table
i print information about a partition
Misc
m print this menu
u change display/entry units
x extra functionality (experts only)
Script
I load disk layout from sfdisk script file
O dump disk layout to sfdisk script file
Save & Exit
w write table to disk and exit
q quit without saving changes
Create a new label
g create a new empty GPT partition table
G create a new empty SGI (IRIX) partition table
o create a new empty DOS partition table
s create a new empty Sun partition table
Command (m for help): ntw
Partition type
p primary (0 primary, 0 extended, 4 free)
e extended (container for logical partitions)
Select (default p): p
Partition number (1-4, default 1): 1
First sector (2048-60555263, default 2048):
Last sector, +/-sectors or +/-size{K,M,G,T,P} (2048-60555263, default 60555263):
Created a new partition 1 of type 'Linux' and of size 28.9 GiB.
Command (m for help):
Command (m for help): m
Help:
DOS (MBR)
a toggle a bootable flag
b edit nested BSD disklabel
c toggle the dos compatibility flag
Generic
d delete a partition
F list free unpartitioned space
l list known partition types
n add a new partition
p print the partition table
t change a partition type
v verify the partition table
i print information about a partition
Misc
m print this menu
u change display/entry units
x extra functionality (experts only)
Script
I load disk layout from sfdisk script file
O dump disk layout to sfdisk script file
Save & Exit
w write table to disk and exit
q quit without saving changes
Create a new label
g create a new empty GPT partition table
G create a new empty SGI (IRIX) partition table
o create a new empty DOS partition table
s create a new empty Sun partition table
Command (m for help): ^C
All unwritten changes will be lost, do you really want to quit? n
Command (m for help): w
The partition table has been altered.
Calling ioctl() to re-read partition table.
Syncing disks.
cosmin@pop-os:~$ lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 1 28.9G 0 disk
└─sda1 8:1 1 28.9G 0 part
nvme0n1 259:0 0 476.9G 0 disk
├─nvme0n1p1 259:1 0 100M 0 part
├─nvme0n1p2 259:2 0 16M 0 part
├─nvme0n1p3 259:3 0 97.1G 0 part
├─nvme0n1p4 259:4 0 499M 0 part
├─nvme0n1p5 259:5 0 330.5G 0 part
├─nvme0n1p6 259:6 0 48.2G 0 part /
└─nvme0n1p7 259:7 0 600M 0 part /boot/efi
cosmin@pop-os:~$ sudo mkfs.ntfs -f /dev/sda1
Cluster size has been automatically set to 4096 bytes.
Creating NTFS volume structures.
mkntfs completed successfully. Have a nice day.
cosmin@pop-os:~$
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment