"Invalid argument" when trying to mount my USB
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
Related videos on Youtube
Jemshit Iskenderov
Updated on September 18, 2022Comments
-
Jemshit Iskenderov over 1 year
I have Fragment and it uses
RecyclerView Adapter
withLoaderManager
to list items.RecyclerView
i use is from this address. I've implementedLoaderManager
in Fragment and gave context of its Activity toRecyclerView
.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 useRecyclerView
withLoader
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
fromstudent_course
table and from thatcursor
i get student ids of specific class. Then using data of firstcursor
, i get secondcursor
fromstudents
table which has list of students from same class. Then i send secondcursor
toadapter
. I do below operation on bothonCreateView()
andonCreateLoader
: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
andselectionArgs1
tonull
, 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 about 11 yearsPlease add the output of
sudo fdisk -l
to your question. -
Eric Carvalho about 11 yearsI think it should be
mount /dev/sdb1 /mnt/usb
. -
web.learner about 11 years@EricCarvalho You should add that as an answer ;-)
-
guntbert about 11 yearsInstead of adding [solved] to the title please accept the correct/useful answer by clicking on the check-mark beside it.
-
hrskrs about 9 yearsshow some code so we can identify the problem
-
Jemshit Iskenderov about 9 years@hrskrs some clarifications added
-