"Invalid argument" when trying to mount my USB

1,294

Solution 1

/dev/sdb represents the whole storage device. The individual partitions are addressed by numbers following the device name, e.g. sdb1 is the 1st partition in the storage device sdb. As USB flash drives usually have only one partition, the mount command should be:

mount /dev/sdb1 /mnt/usb

Solution 2

Since this is among the top results I want to share some insight about what happened to me and how I solved it.

My situation is that I'm booting the 18.04 di-based server installer and I want to mount another (virtual) optical disc drive. Which gave me this exact error message.

Observation:

  • I'm in a busybox shell, which may behave different than GNU tools.
  • I have a different, limited kernel running. While the error message gave no indication and all arguments seemed to be correct I tried loading the filesystem module, iso9660 in my case, with modprobe. Then it worked. So whatever filesystem you are trying to mount, you should check (lsmod?) that the respective filesystem module is loaded to. It's unlikely that the OP was on busybox, but hey questions with not enough context are common and we are trying to solve them.

Solution 3

sda or sdb is just the name of your storage device, if you want to mount it you must enter the partition number too.

mkdir -p /media/usb
mount /dev/sdb1 /media/usb
Share:
1,294

Related videos on Youtube

Jemshit Iskenderov
Author by

Jemshit Iskenderov

Updated on September 18, 2022

Comments

  • Jemshit Iskenderov
    Jemshit Iskenderov over 1 year

    I have Fragment and it uses RecyclerView Adapter with LoaderManager to list items. RecyclerView i use is from this address. I've implemented LoaderManager in Fragment and gave context of its Activity to RecyclerView.

    When i add new item to list, it does not refresh and show new item in list. I use same Adapter and structure on another activity and it works good. But here i use RecyclerView with Loader inside Fragment and it does not refresh list when i add item, instead i have to go back(finish fragment) and enter again.

    I have 2 tables like this. First I get cursor from student_course table and from that cursor i get student ids of specific class. Then using data of first cursor, i get second cursor from students table which has list of students from same class. Then i send second cursor to adapter. I do below operation on both onCreateView() and onCreateLoader:

    String[] projection0 = {
                DatabaseOpenHelper.COL_STUDENT_ID,
                DatabaseOpenHelper.COL_COURSE_ID};
        String selection0=DatabaseOpenHelper.COL_COURSE_ID + "=?";
        String selectionArgs0[]={String.valueOf(courseId)};
        mDataset0=getActivity().getContentResolver().query(StudentContentProvider.CONTENT_URI2, projection0,selection0,selectionArgs0,null);
    
    
        if(mDataset0.getCount()!=0) {
            //BATCH
            List<String> selectionList = new ArrayList<String>();
            mDataset0.moveToFirst();
    
            ...
            String[] projection1 = {
                    DatabaseOpenHelper.COLUMN_ID,
                    DatabaseOpenHelper.COL_STUDENT_NUMBER,
                    DatabaseOpenHelper.COL_STUDENT_NAME,
                    DatabaseOpenHelper.COL_STUDENT_CARD_ID,
                    DatabaseOpenHelper.COL_STUDENT_COLOR};
            selection1 = selection1.substring(0, selection1.length() - 2) + ")";
            mDataset1 = getActivity().getContentResolver().query(StudentContentProvider.CONTENT_URI1, projection1, selection1, selectionArgs1, null);
    
        }else{
            mDataset1=null;
        }
    ...
    mAdapter = new studentListAdapter(getActivity(),mDataset1,this);
    

    mDataset1 is students of same class.

    1) What might be the problem ? 2) Is there any way to implement LoaderManager class inside

    Update 1: When i change selection1 and selectionArgs1 to null, it updates list immediately after i add item. But it shows all students from every class because i didn't specify selection.

    Update 2: When i check onLoadFinished() i see that new cursor, after loading new content, is still same as old.

    • Mouli
      Mouli about 11 years
      Please add the output of sudo fdisk -l to your question.
    • Eric Carvalho
      Eric Carvalho about 11 years
      I think it should be mount /dev/sdb1 /mnt/usb.
    • web.learner
      web.learner about 11 years
      @EricCarvalho You should add that as an answer ;-)
    • guntbert
      guntbert about 11 years
      Instead of adding [solved] to the title please accept the correct/useful answer by clicking on the check-mark beside it.
    • hrskrs
      hrskrs about 9 years
      show some code so we can identify the problem
    • Jemshit Iskenderov
      Jemshit Iskenderov about 9 years
      @hrskrs some clarifications added