How to differentiate a mounted usb stick vs plugged in but not mounted usb stick.
Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
How to differentiate a mounted usb stick vs plugged in but not mounted usb stick.
I have a bootable usb live stick plugged in, it is in /dev/sdd
Code:
$lsblk
sdd 8:48 1 961M 0 disk
└─sdd1 8:49 1 7,3M 0 part
But i can't access to it.. i suppose it is not mounted ??
but it is listed in /dev/sdd, ... so it is mounted ??
So is it mounted or not mounted ?
I am confused..
Pls tell me how to know if a usb device is mounted or not ? I need to get this part cleared, because i can't be sure of it.
Distribution: Currently: OpenMandriva. Previously: openSUSE, PCLinuxOS, CentOS, among others over the years.
Posts: 3,881
Rep:
Quote:
Originally Posted by andrewysk
I have a bootable usb live stick plugged in, it is in /dev/sdd
Code:
$lsblk
sdd 8:48 1 961M 0 disk
└─sdd1 8:49 1 7,3M 0 part
But i can't access to it.. i suppose it is not mounted ??
but it is listed in /dev/sdd, ... so it is mounted ??
So is it mounted or not mounted ?
I am confused..
Pls tell me how to know if a usb device is mounted or not ? I need to get this part cleared, because i can't be sure of it.
Thx
Run lsblk with the -f argument, then look under the "MOUNTPOINT" column; if you see a blank line, than it's not mounted, if you don't see a blank line, then it's probably mounted.
Something being "mounted" means it's attached to the filesystem hierarchy, which starts at the forward slash (/). Also it's the filesystem that gets "mounted".
Run lsblk with the -f argument, then look under the "MOUNTPOINT" column; if you see a blank line, than it's not mounted, if you don't see a blank line, then it's probably mounted.
Something being "mounted" means it's attached to the filesystem hierarchy, which starts at the forward slash (/). Also it's the filesystem that gets "mounted".
I don't see a blank line, however it is totally blank.. Does that means it is not mounted ? I have plugged it in and out for many times, it is just the same..
So when a device is not mounted to a folder, (even when i can see it in /dev/sdx), that still means it is not mounted.. only detected.. ?
As for other usb stick, it will auto mount. But this "supergrub2 boot usb" does not automount. wonderwhy.. could it because the filesystem of this usbstick is not the normally acceptable filesystem ?
How do i mount this device then ? i want to edit the grub.cfg file in it.
Plain 'mount' command will list all mounted filesystems, you can grep it for /dev/sd to display only block devices.
So, as long as any device is not listed in $mount command, it is consider as not mounted (be it available in /dev/sdx) ?
$mount
$df
Only these 2 cmds tells what is mounted, those devices not in the list are consider not mounted. Correct me if i am wrong.
why it is mount in read only ? is it due to the format is in "iso966" ISOIMAGE ?
Is there way for me to make it writable ?
Code:
$ cd /mnt/supergrub2_bootdisk/
/mnt/supergrub2_bootdisk
$ ls
boot boot.catalog
Weird, I can see a folder and a file in the usbstick using terminal
But when i check it with dolpin gui, i can't see anything, (even when i have "show hidden file" checked)
Code:
$ cd boot
/mnt/supergrub2_bootdisk/boot
$ ls
grub
$ cd grub
/mnt/supergrub2_bootdisk/boot/grub
$ ls -al
total 2401
dr-xr-xr-x 1 root root 2048 Aug 26 2019 .
dr-xr-xr-x 1 root root 2048 Aug 26 2019 ..
-r--r--r-- 1 root root 1836 Aug 26 2019 afd2012.cfg
-r--r--r-- 1 root root 1560 Aug 26 2019 afdmsg.cfg
dr-xr-xr-x 1 root root 2048 Aug 26 2019 fonts
-r--r--r-- 1 root root 1038 Aug 26 2019 grub.cfg
dr-xr-xr-x 1 root root 36864 Aug 26 2019 i386-pc
-r--r--r-- 1 root root 270 Aug 26 2019 loopback.cfg
dr-xr-xr-x 1 root root 2048 Aug 26 2019 roms
dr-xr-xr-x 1 root root 6144 Aug 26 2019 sgd
-r--r--r-- 1 root root 2400500 Aug 26 2019 unifont.pf2
What are you trying to accomplish? While I've never played with supergrub it is a live version which is why you see the iso966 for sdd. sdd1 does not show a filesystem so I don't know how it is used.
Yes it is readonly because it is a live CD even though it is a USB drive. No it is not writable. You would have to remaster a new CD image.
Distribution: openSUSE, Raspbian, Slackware. Previous: MacOS, Red Hat, Coherent, Consensys SVR4.2, Tru64, Solaris
Posts: 2,818
Rep:
Quote:
Originally Posted by andrewysk
I have a bootable usb live stick plugged in, it is in /dev/sdd
Code:
$lsblk
sdd 8:48 1 961M 0 disk
└─sdd1 8:49 1 7,3M 0 part
"lsblk" is for seeing what block devices are recognized by the operating system. "Recognized doesn't mean they're mounted, as you've discovered from the output of "lsblk".
Try: "apropos mount" and, then, read the man pages for the commands that have descriptions related to mounting/umounting.
I don't see a blank line, however it is totally blank.. Does that means it is not mounted ? I have plugged it in and out for many times, it is just the same..
So when a device is not mounted to a folder, (even when i can see it in /dev/sdx), that still means it is not mounted.. only detected.. ?
As for other usb stick, it will auto mount. But this "supergrub2 boot usb" does not automount. wonderwhy.. could it because the filesystem of this usbstick is not the normally acceptable filesystem ?
How do i mount this device then ? i want to edit the grub.cfg file in it.
You are talking apples and oranges.
A device shows as /dev/sdd and /dev/sdd1 when the system has identified it as a block device and knows it has one partition defined. This is at the device level and has nothing to do with a file system being mounted or not.
If you run the mount command and see something like this
Code:
mount
/dev/sdg1 on /run/media/user/Fedora-WS-Live-34_B-1-3 type iso9660 (ro,nosuid,nodev,relatime,nojoliet,check=s,map=n,blocksize=2048,uid=1000,gid=1000,dmode=500,fmode=400,uhelper=udisks2)
then you can say that the filesystem on device /dev/sdg1 is of type iso9660 and is mounted at /run/media/user/Fedora-WS-Live-34_B-1-3
The "lsblk -f" command shows the same thing in a different way
lsblk shows filesystems with the mount point listed, as you can see by the above two entries.
df also shows all mounted filesystems as below
Code:
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/sdg1 1954560 1954560 0 100% /run/media/jvian/Fedora-WS-Live-34_B-1-3
If your usb stick is not mounted automatically when you plug it in, simply run a mount command such as "sudo mount /dev/sdd1 /mnt" then it can be seen and accessed under the /mnt directory. The mount attempts you posted above were for /dev/sdd, which is not a partition containing the file system. Make sure you are doing the mount with /dev/sdd1 instead.
Last edited by computersavvy; 04-03-2021 at 08:30 PM.
If you are trying to alter that .iso, mount it loopback, copy the contents to another empty directory, make your edits, then make another .iso out of the new directory, burn that .iso to stick. Then you'll have the original and the altered one. (I renamed that .iso that I got yesterday, name was too long for me.)
Example, use your own parameters.
Code:
#Couple of empty directories to work with
mkdir mydir
mkdir mydir2
#Mount the .iso
mount -o loop ~/super_grub2_efi.iso ~/mydir/
#Copy it somewhere
cp -r ~/mydir/* ~/mydir2/
#Make the files writable
sudo chmod -R +w ~/mydir2/*
#Edit ~/mydir2/boot/grub/grub.cfg
#Edit whatever else you want
#Make .iso from altered directory, as I recall genisoimage wants a full path
genisoimage -o super_grub_fixed.iso -r -J /path/to/mydir2/*
#Burn .iso to stick
You are talking apples and oranges.
A device shows as /dev/sdd and /dev/sdd1 when the system has identified it as a block device and knows it has one partition defined. This is at the device level and has nothing to do with a file system being mounted or not.
If you run the mount command and see something like this
Code:
mount
/dev/sdg1 on /run/media/user/Fedora-WS-Live-34_B-1-3 type iso9660 (ro,nosuid,nodev,relatime,nojoliet,check=s,map=n,blocksize=2048,uid=1000,gid=1000,dmode=500,fmode=400,uhelper=udisks2)
then you can say that the filesystem on device /dev/sdg1 is of type iso9660 and is mounted at /run/media/user/Fedora-WS-Live-34_B-1-3
The "lsblk -f" command shows the same thing in a different way
lsblk shows filesystems with the mount point listed, as you can see by the above two entries.
df also shows all mounted filesystems as below
Code:
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/sdg1 1954560 1954560 0 100% /run/media/jvian/Fedora-WS-Live-34_B-1-3
If your usb stick is not mounted automatically when you plug it in, simply run a mount command such as "sudo mount /dev/sdd1 /mnt" then it can be seen and accessed under the /mnt directory. The mount attempts you posted above were for /dev/sdd, which is not a partition containing the file system. Make sure you are doing the mount with /dev/sdd1 instead.
*****
The rest of your post, i can understand, but this part i can't.. I hope to clarify it once for all.. Hence i asked question so horribly meticulously.. please don't be annonyed.
Quote:
Originally Posted by computersavvy
You are talking apples and oranges.
A device shows as /dev/sdd and /dev/sdd1 when the system has identified it as a block device and knows it has one partition defined. This is at the device level and has nothing to do with a file system being mounted or not.
You said:
/dev/sdd is a device
/dev/sdd1 is a partition of /dev/sdd
Quote:
Originally Posted by computersavvy
The mount attempts you posted above were for /dev/sdd, which is not a partition containing the file system. Make sure you are doing the mount with /dev/sdd1 instead.
According to what You said: "/dev/sdd" is not a partition containing filesystem.
According to what you said above, "/dev/sdc" should be also be a device, not partition; /dev/sdc1 (if exist) should be a partition which can then be mounted.
Question 1:
I assume: one can only mount a partition, Cannot mount the device itself , am i right ?
Question 2:
Why then (below) /dev/sdc can be mounted to "/run/media" since /dev/sdc is a device (just like /dev/sdd)? why then can't i mount "/dev/sdd" ?
You see:
/dev/sdc has got Filesystem type: ext4
/dev/sdd has also got a Filesystem, just different type of Filesystem: ISO966
Repeated questions (as above):
can i mount a device : /dev/sdx ?
or
i can only mount a partition of a device: /dev/sdx1 (example)
Question3:
I think i don't know what is a device, and what is a partition with refering to these formats:
example:
/dev/sda FSTYPE: vfat <-- device ?
/dev/sda1 Fstype: ext4 < ---partition ? is it possible to have device and partition of different fstype ?
/dev/sdb Fstype: ext4 <--- device ?
/dev/sdb1 Fstype: <blank> <--- partition that is not formated ? is it possible ? why then i have got /dev/sdd1 with fstype <blank> (as below) ?
/dev/sdc fstype: <blank> <--- device without filesystem?
/dev/sdc1 fstype: ext4 <-- but partition with fstype: ext4 **is this scenario exist ? **
Question4 (refering to below real example):
Why these 2 devices is opposite of each other (with refering to fstype) ? Can someone please tell me what is the criteria of "a partition" and what is the criteria to be called "a device" ? Is it just by /dev/sdd vs /dev/sdd1 ? or is it determined by wether it has got fstype ?
example:
/dev/sdb <---there is no fstype here
however there is fstype in /dev/sdb1
This is opposite as this:
/dev/sdd <--- fstype: iso966
however there is NO fstype in /dev/sdd1
Question 4-1:
to be even more meticulous in questioning:
/dev/sdd <no fstype>
/dev/sdd fstype: ext4
/dev/sdd1 <no fstype>
/dev/sdd1 fstype: ext4
Which is call what between the above 4 example ? partition ? device ? partition without Fstype ? device without fstype ?
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.