How do I know the device path to an USB-stick?
Solution 1:
First plug in your USB-Stick.
Then type:
lsblk
Your output should look something like this
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 465,8G 0 disk
├─sda1 8:1 0 74,5G 0 part /
├─sda2 8:2 0 390,2G 0 part /home
├─sda3 8:3 0 1K 0 part
└─sda5 8:5 0 1G 0 part [SWAP]
Now you can use the size to determine which one is your usb stick . To mount it somewhere in your home folder for example just type:
mkdir ~/UsbStick
sudo mount /dev/PATH_TO_YOUR_STICK ~/UsbStick
obviously replacing PATH_TO_YOUR_STICK
with the right /dev/sdX
path and ~/UsbStick
with the directory you created using the mkdir
command
Solution 2:
find device path, LABEL, UUID and TYPE of block devices with help of command
sudo blkid
result will be like
/dev/sda1: UUID="XXXX" TYPE="ntfs"
/dev/sda5: UUID="XXXX-XXXX" TYPE="ext4"
/dev/sda6: UUID="XXXX-XXXX" TYPE="swap"
/dev/sda7: UUID="XXXX-XXXX" TYPE="ext4"
/dev/sda8: UUID="XXXX-XXXX" TYPE="ext4"
/dev/sdb1: LABEL="p" UUID="XXXX-XXXX" TYPE="vfat"
get your device path and fire mount command for usb-stick.
Solution 3:
Device names of flash drives
A flash drive can be connected
-
via USB (typically a USB stick or a memory card via a USB adapter)
-
the device name is the same as for SATA drives,
/dev/sdx
-
and partitions are named
/dev/sdxn
where x
is the device letter and n
the partition number, for example /dev/sda1
-
via PCI (typically a memory card in a built-in slot in a laptop)
-
the device name is
/dev/mmcblkm
-
and partitions are named
/dev/mmcblkmpn
where m
is the device number and n
the partition number, for example /dev/mmcblk0p1
Example with an SSD, HDD, USB pendrive and an SD card
lsblk
$ sudo lsblk -o model,name,fstype,size,label,mountpoint
MODEL NAME FSTYPE SIZE LABEL MOUNTPOINT
Samsung SSD 850 sda 232,9G
├─sda1 vfat 300M EFI /boot/efi
├─sda2 1M
├─sda3 ext4 100G root
└─sda4 swap 5G [SWAP]
00BEKT-00PVMT0 sdb 298,1G
├─sdb1 vfat 480M
├─sdb2 ext4 80G lubuntu-xenial64 /media/tester/lubuntu-xenial64
├─sdb3 swap 3,9G [SWAP]
├─sdb4 ext4 100G ubuntu-artful64x /
└─sdb5 ext4 113,7G ubuntu-artful64w /media/tester/ubuntu-artful64w
Extreme sdc 14,6G
├─sdc1 ntfs 6,7G usbdata /media/tester/usbdata1
├─sdc2 1M
├─sdc3 vfat 244M usbboot
├─sdc4 iso9660 948M Lubuntu 17.10 i386 /media/tester/Lubuntu 17.10 i386
└─sdc5 ext4 6,7G casper-rw /media/tester/casper-rw
mmcblk0 3,7G
├─mmcblk0p1 ntfs 661M usbdata /media/tester/usbdata
├─mmcblk0p2 1K
├─mmcblk0p3 vfat 122M usbboot /media/tester/usbboot
├─mmcblk0p4 iso9660 355M 9w-dus /media/tester/9w-dus
└─mmcblk0p5 ext4 2,6G persistence /media/tester/persistence
Edit for lsblk
list: With modern versions of Ubuntu you need not use sudo
, and when there are (many) snaps, and we don't want them to clutter the list, you the following command line,
lsblk -o model,name,fstype,size,label,mountpoint | grep -v " loop.*snap"
parted
$ sudo parted -ls
[sudo] password for tester:
Model: ATA Samsung SSD 850 (scsi)
Disk /dev/sda: 250GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags:
Number Start End Size File system Name Flags
1 1049kB 316MB 315MB fat32 boot, esp
2 316MB 317MB 1049kB
3 317MB 108GB 107GB ext4 root
4 244GB 249GB 5369MB linux-swap(v1)
Model: WDC WD32 00BEKT-00PVMT0 (scsi)
Disk /dev/sdb: 320GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags:
Number Start End Size File system Name Flags
1 33,6MB 537MB 503MB fat32 EFI System Partition boot, esp
2 537MB 86,4GB 85,9GB ext4
4 86,4GB 194GB 107GB ext4
5 194GB 316GB 122GB ext4
3 316GB 320GB 4161MB linux-swap(v1)
Model: SanDisk Extreme (scsi)
Disk /dev/sdc: 15,7GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags:
Number Start End Size File system Name Flags
2 1049kB 2097kB 1049kB primary bios_grub
3 2097kB 258MB 256MB fat32 primary boot, esp
4 258MB 1252MB 994MB primary
5 1252MB 8473MB 7221MB ext2 primary
1 8473MB 15,7GB 7221MB ntfs primary msftdata
Model: SD SD04G (sd/mmc)
Disk /dev/mmcblk0: 3965MB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags:
Number Start End Size Type File system Flags
3 2097kB 130MB 128MB primary fat32 boot
4 130MB 502MB 372MB primary
2 502MB 3272MB 2769MB extended lba
5 503MB 3272MB 2768MB logical ext2
1 3272MB 3965MB 693MB primary ntfs