Mounting USB Partition in openSUSE LinuxMounting USB Partition in openSUSE Linux

26 04 2007

In most cases, when you put a USB stick into your USB port on a machine running openSUSE, a window will appear asking what you’d like to do. This is done by the Hardware Abstraction Layer service running in the background.

However, what about cases where you need to manually mount a USB stick? For example, if you have a custom-compiled kernel module that you need to load off a USB stick during installation, what do you do? HAL ain’t gonna save your bacon. You’ll want to know how to get the USB stuff up and cracking very quickly with minimal fooling around.

This is a quick re-write of my last tip, except that it is easier for users with regular accounts to work with the USB stick.

In your /proc directory, there is a file called partitions. To see which partitions are available to the system at any given time, you can do cat /proc/partition at a terminal. With no USB sticks plugged in, mine looks like this:

[2001][scott@desk:~]$ cat /proc/partitions
major minor  #blocks  name

   3     0  195360984 hda
   3     1      40131 hda1
   3     2    1959930 hda2
   3     3   29302560 hda3
   3     4  164055780 hda4

Now, when I plug in a USB stick (or card reader with a card inserted), this is what I get:

[2001][scott@desk:~]$ cat /proc/partitions
major minor  #blocks  name

   3     0  195360984 hda
   3     1      40131 hda1
   3     2    1959930 hda2
   3     3   29302560 hda3
   3     4  164055780 hda4
   8     0     124048 sda
   8     1     123888 sda1

You can see that sda and sda1 were added. sda refers to the drive. It’s the sda1 that we care about. Just add /dev/ to the front of that to get the partition we want to mount. Our partition is /dev/sda1.

Next, we just pick a place to mount it to. As su I just create a directory called /media/usbstick or something similar. Then, you run your mount command as su with this syntax:

mount -t [filesystem type] [usb stick partition] [target mount point] -o rw,nosuid,nodev,noatime,uid=1000,utf8,shortname=lower

If I were mounting the USB stick as /dev/sda1 onto the mount point /media/usbstick, this command would look like this:

mount -t vfat /dev/sda1 /media/usbstick -o rw,nosuid,nodev,noatime,uid=1000,utf8,shortname=lower

In most cases, vfat for the filesystem type for a USB stick should work just fine (unless you know it to be something else).

After you run this command, you should be in business. You can open a terminal as your regular user and change and modify the USB partition with minimal trouble.

If you wish to have this USB partition mounted automatically, you can edit your /etc/fstab file to do this.

As su, open your /etc/fstab file in your favorite text editor. Add a line, with this syntax:

[usb stick partition]            [target mount point]      auto       auto,user

If using /dev/sda1 as my usb stick partition and /media/usbstick as my target mount point, I would put this into my fstab:

/dev/sda1            /media/usbstick      auto       auto,user

The only thing you really need to know about this is that it makes it so that regular users can mount the USB stick. Of course, the user who mounts it is considered as the owner of the partition and its files (at least in the case of the USB stick).

Save your file and exit. Then, to mount it, just run the following command (as a normal user, even):

mount /media/usbstick

You will then notice that your user has full access to the USB stick.

To Review:

  1. cat /proc/partitions – find the partition of your USB stick
  2. make a mount point (perhaps in /media) to which you will mount the USB stick
  3. for user accessibility, edit your /etc/fstab file
  4. mount the usb stick

Most of the time, when you plug in a USB stick or card reader (with a card in it), SUSE will just pop open a window asking you if you want to see the contents of the device. However, in cases where that does not happen, or you are using a distribution that doesn’t do that, this is one way to mount a USB partition.

Source: by Scott Morris




5 responses

27 05 2007
venu gopal

Hi man,
It’s fine and clear. u gave complete idea about how mounting works.

5 01 2008
Good Credit

Most people are not smart enough to figure out the real costs of their credit cards. Credit cards don’t give you any money. It’s just a way to borrow and the time will come to pay the money back. I hope people will think more and read more professional advice on the net at such websites as

discover lowest apr


22 02 2008

But what about, if you don not have access to root? As a normal user can you mount your USB stick / drive? if you can, please let me know (openSUSE 10.3 (i586)). Thanks


26 03 2009

thanks 🙂

additionally we can create a Custom application launcher that executes “mount /media/usbstick ” when its icon is clicked .. i dunno whther this wud work out ..but if it works then its fine 🙂

29 05 2012
Mirvat Norlaugb

Greetings from Carolina! I’m bored to tears at work so I decided to browse your blog on my iphone during lunch break. I love the info you provide here and can’t wait to take a look when I get home. I’m amazed at how quick your blog loaded on my mobile .. I’m not even using WIFI, just 3G .. Anyhow, awesome site!

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: