🌑

Linhost.info

Mount A USB Drive In Ubuntu Server

Before we can mount a USB drive we need to gather some information about it. With the help of fdisk we can see that my 4GB USB drive was recognized as /deb/sdc1 and is formatted with FAT32.

1
2
3
4
5
6
7
8
9
10
11
sudo fdisk -l

Disk /dev/sdc: 4049 MB, 4049600512 bytes
255 heads, 63 sectors/track, 492 cylinders, total 7909376 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 identifier: 0x04c91666

Device Boot Start End Blocks Id System
/dev/sdb1 \* 2048 7909375 3953664 b W95 FAT32

Now create a mount point where the USB drive will be mounted. Only one drive per mount point.

1
sudo mkdir /media/usb

There is a good change your USB drive will be formatted with FAT16/32 therefore using the parameter -t vfat will suffice, otherwise you can use -t ntfs or -t ext3 depending on the file system.

1
sudo mount -t vfat /dev/sdb1 /media/usb

Make sure drive was mounted with the help of df -h. The 4GB USB drive is mounted and accessible from the /media/usb mount point.

1
2
3
4
5
6
7
8
9
user@debian:~$ df -h
Filesystem Size Used Avail Use% Mounted on
rootfs 49G 18G 29G 38% /
udev 10M 0 10M 0% /dev
tmpfs 100M 432K 100M 1% /run
/dev/disk/by-uuid/af874479-b4ee-4d83-a3da-d2fdb48511ea 49G 18G 29G 38% /
tmpfs 5.0M 0 5.0M 0% /run/lock
tmpfs 404M 0 404M 0% /run/shm
/dev/sdb1 3.8G 6.6M 3.8G 1% /media/usb

To un-mount the drive you can simply use the umount command folowed the mount point.

1
sudo umount /media/usb

, — Sep 23, 2013