Restore the size of USB drive in Linux

 

  1. Run lsblk command to find outUSB partition. In this case you see the USB flash drive is sdb so you VERY CAREFULLY run:
    #sudo dd if=/dev/zero of=/dev/sdb count=100
  2. Create a new partition table in the format you like:
    #dd if=/dev/zero of=/dev/sdb bs=32k count=1
  3. Create mounting point:
    #sudo mkdir /media/external
  4. Mount the Drive: We can now mount the drive. Let’s say the device is /dev/sdb1, the filesystem is FAT16 or FAT32 (like it is for most USB flash drives), and we want to mount it at /media/external (having already created the mount point):
    #sudo mount -t vfat /dev/sdb /media/external -o uid=1000,gid=1000,utf8,dmask=027,fmask=137
  5. OR
  6. If the device is formatted with NTFS, run:
    #sudo mount -t ntfs-3g /dev/sdb1 /media/external
    Note: You must have the ntfs-3g driver installed
  7. Unmounting the Drive:
    #sudo umount /dev/sdb
  8. ENJOY

Comments

Popular posts from this blog

Convert .iso Image to .qcow2 Image

How to reset password in single user mode in Ubuntu 18.04

THE ULTIMATE DOCKER CHEAT SHEET