SaltyCrane Blog — Notes on JavaScript and web development

Mount drives manually on Ubuntu Linux

Since I'm running the wmii window manager instead of Gnome or KDE, devices such as USB drives, external hard drives, and SD card readers don't automatically mount. This can be good or bad depending on your preference. Here are my notes on mounting devices manually. I am no expert at this stuff, so use this at your own risk. There is definitely the possibility of losing data when dealing with this stuff. Read the man pages and use this just as a refresher. As an example, I will mount a SD card.


To see what devices are available:
$ sudo fdisk -l
This gives me the following output:
Disk /dev/sda: 250.0 GB, 250000000000 bytes
255 heads, 63 sectors/track, 30394 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x38000000

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1               1           7       56196   de  Dell Utility
/dev/sda2               8         660     5245222+   b  W95 FAT32
/dev/sda3   *         661       30017   235810102+  83  Linux
/dev/sda4           30018       30394     3028252+   5  Extended
/dev/sda5           30018       30394     3028221   82  Linux swap / Solaris

Disk /dev/sdf: 320.0 GB, 320072933376 bytes
255 heads, 63 sectors/track, 38913 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x0008bc3c

   Device Boot      Start         End      Blocks   Id  System
/dev/sdf1               1       38913   312568641   83  Linux

Disk /dev/sdd: 512 MB, 512229376 bytes
9 heads, 8 sectors/track, 13895 cylinders
Units = cylinders of 72 * 512 = 36864 bytes
Disk identifier: 0x00000000

   Device Boot      Start         End      Blocks   Id  System
/dev/sdd1               4       13896      500107+   6  FAT16
/dev/sda3 is my main hard disk partition and /dev/sdf1 is an external hard drive formatted for Linux. The last device, /dev/sdd1 is my SD card.

Create a mount point
$ sudo mkdir /media/sdcard

Mount the device
$ sudo mount /dev/sdd1 /media/sdcard
Now you can access the files at /media/sdcard.

List mounted devices
$ mount -l
You should see things such as:
/dev/sda3 on / type ext3 (rw,errors=remount-ro) []
proc on /proc type proc (rw,noexec,nosuid,nodev)
/sys on /sys type sysfs (rw,noexec,nosuid,nodev)
udev on /dev type tmpfs (rw,mode=0755)
/dev/sdf1 on /media/disk type ext3 (rw,nosuid,nodev,uhelper=hal) []
tmpfs on /lib/modules/2.6.24-18-generic/volatile type tmpfs (rw,mode=0755)
/dev/sdd1 on /media/sdcard type vfat (rw) []
The last line shows device /dev/sdd1 mounted at /media/sdcard.

Unmount the device
$ sudo umount /media/sdcard
or
$ sudo umount /dev/sdd1

Comments


#1 Sven commented on :

Good Job! :)


#2 seba commented on :

hey, when i do this: Mount the device $ sudo mount /dev/sdd1 /media/sdcard it says:

mount: you must specify the filesystem type ... what should i do!


#3 cahyo commented on :

seba

edit your command with $sudo mount -t vfat /dev/sdd1 /media/sdcard


#5 npeducations commented on :

instead of fdisk, use "df-h" simply list the devices in easy format

disqus:2561339947