Tuesday 2 March 2021

Linux - Detect, Format & Mount USB-Flash Stick Natively

I've had yet another drive fail in one of my old Linux servers, this was an old 2.5" mechanical just used for booting... so I'm able to go in; just about; and copy all the data off of the machine.

However, the USB-flash drive I chose as my life-boat was being a bit of a pain, here's the commands I did:

  • ls /dev/sd*
    (and note down the replies)
    (insert the USB-Stick)
  • ls /dev/sd*
    (note the label of the new drive, for me this is /dev/sdc)
  • sudo fdisk /dev/sdc
    (delete the existing exFat partition)
    (new partition max size - of Linux type)
    (write & exit)
  • sudo mkfs.ext4 /dev/sdc1
  • mkdir ~/external
  • sudo mount /dev/sdc1 ~/external
  • sudo chown <myUser> ~/external/
  • rsync -a -v /myData/ ~/external
I could "sudo" rsync and save the need to chown, but here you go.

I'm out, more from the HMS Rodney build soon!

No comments:

Post a Comment