Objective
The procedure on how to mount USB drive on Kali Linux is no different from any other Linux distribution. Kali Linux was used by this guide to provide you with simple to follow steps on how to mount USB drive on Linux.
Operating System and Software Versions
- Operating System: – Kali Linux
Requirements
Privileged access to your Kali Linux system will be required.
Difficulty
EASY
Conventions
- # – requires given linux commands to be executed with root privileges either directly as a root user or by use of
sudo
command - $ – requires given linux commands to be executed as a regular non-privileged user
Video
Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk /dev/sdc: 1.9 GiB, 2064646144 bytes, 4032512 sectors Units: sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disklabel type: dos Disk identifier: 0x0c56e3d1 Device Boot Start End Sectors Size Id Type /dev/sdc1 2048 4032511 4030464 1.9G b W95 FAT32 root@kali:~# mkdir /media/usb-drive root@kali:~# mount /dev/sdc1 /media/usb-drive/ root@kali:~# mount | grep sdc1 /dev/sdc1 on /media/usb-drive type vfat (rw,relatime,fmask=0022,dmask=0022,codepage=437,iocharset=utf8,shortname=mixed,errors=remount-ro) root@kali:~# cd /media/usb-drive/ root@kali:/media/usb-drive# echo "kali linux" > file.txt root@kali:/media/usb-drive# cat file.txt kali linux root@kali:/media/usb-drive# cd root@kali:~# umount /media/u
00:00
Instructions
USB Block Device Name
Given you have already inserted your USB drive into your computer, we first need to determine a block device name of your USB partitions. The easiest way to approach this is by executing fdisk -l
command to list all drives and their associated partitions.
# fdisk -l ... ... Disk /dev/sdc: 1.9 GiB, 2064646144 bytes, 4032512 sectors Units: sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disklabel type: dos Disk identifier: 0x0c56e3d1 Device Boot Start End Sectors Size Id Type /dev/sdc1 2048 4032511 4030464 1.9G b W95 FAT32
Scan through the output of the above fdisk -l
command and find partition block name. In the example above it is /dev/sdc1
.
Create Mount Point
Next, create a mount point to serve as a destination target directory for USB partition mount. This directory will after we mount the above USB partition contain all files stored your USB drive. Choose any name for your USB mount point directory, e.g., usb-drive
.
# mkdir /media/usb-drive
Mount USB drive
At this stage, we are ready to mount our USB drive partition. Execute, the below mount command while replacing the block device path ( /dev/sdc1 ) with the one you took a note about previously.
# mount /dev/sdc1 /media/usb-drive/
Access Your USB drive
Optionally check to see whether your USB drive has been mounted correctly using the following linux command:
# mount | grep sdc1 /dev/sdc1 on /media/usb-drive type vfat (rw,relatime,fmask=0022,dmask=0022,codepage=437,iocharset=utf8,shortname=mixed,errors=remount-ro)
Access your files on your USB drive by navigating to the previously created mount point directory/media/usb-drive
:
# cd /media/usb-drive # ls
Unmount USB
Do not remove your USB drive before you do not perform a proper umount otherwise your risk losing your data:
# umount /media/usb-drive
Permanent Mount
Disk /dev/loop0: 2.5 GiB, 2634285056 bytes, 5145088 sectors Units: sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk /dev/sdc: 1.9 GiB, 2064646144 bytes, 4032512 sectors Units: sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disklabel type: dos Disk identifier: 0x0c56e3d1 Device Boot Start End Sectors Size Id Type /dev/sdc1 2048 4032511 4030464 1.9G b W95 FAT32 root@kali:~# ls -l /dev/disk/by-uuid/* lrwxrwxrwx 1 root root 10 Feb 8 23:27 /dev/disk/by-uuid/1D83-5BFF -> ../../sdc1 lrwxrwxrwx 1 root root 10 Feb 8 22:31 /dev/disk/by-uuid/2016-08-30-11-31-31-00 -> ../../sdb1 lrwxrwxrwx 1 root root 10 Feb 8 22:31 /dev/disk/by-uuid/3eccfd4e-bd8b-4b5f-9fd8-4414a32ac289 -> ../../sda1 lrwxrwxrwx 1 root root 10 Feb 8 22:31 /dev/disk/by-uuid/4082248b-809d-4e63-93d2-56b5f13c875f -> ../../sda5 lrwxrwxrwx 1 root root 10 Feb 8 22:31 /dev/disk/by-uuid/E6E3-F2A2 -> ../../sdb2 root@kali:~# echo "/dev/disk/by-uuid/1D83-5BFF /media/usb-drive vfat 0 0" >> /etc/fstab root@kali:~# mount -a root@kali:~# cat /media/usb
00:00
In case you need to mount your USB drive permanently after reboot first you need to determine the UUID belonging to USB partition you wish to mount:
# ls -l /dev/disk/by-uuid/*
Create a new /etc/fstab
entry:
# echo "/dev/disk/by-uuid/1D83-5BFF /media/usb-drive vfat 0 0" >> /etc/fstab
Your USB drive will now mount automatically after reboot. Please, note that the UUID uniqueness is not guaranteed. It is recommended to use partition tags instead, but that is a tale for another time.