LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This 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


Reply
  Search this Thread
Old 04-03-2021, 08:41 AM   #1
andrewysk
Member
 
Registered: Mar 2020
Posts: 797

Rep: Reputation: Disabled
Question 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.

Thx

Last edited by andrewysk; 04-03-2021 at 08:44 AM.
 
Old 04-03-2021, 08:45 AM   #2
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,784

Rep: Reputation: 5937Reputation: 5937Reputation: 5937Reputation: 5937Reputation: 5937Reputation: 5937Reputation: 5937Reputation: 5937Reputation: 5937Reputation: 5937Reputation: 5937
Code:
NAME                    MAJ:MIN RM   SIZE RO TYPE  MOUNTPOINT
sda                       8:0    0 931.5G  0 disk  
├─sda1                    8:1    0     1G  0 part  /boot
Not enough information...

When mounted the output will display its mount point. You can also check the output of mount or df.

Last edited by michaelk; 04-03-2021 at 08:51 AM.
 
Old 04-03-2021, 09:01 AM   #3
jsbjsb001
Senior Member
 
Registered: Mar 2009
Location: Earth, unfortunately...
Distribution: Currently: OpenMandriva. Previously: openSUSE, PCLinuxOS, CentOS, among others over the years.
Posts: 3,881

Rep: Reputation: 2063Reputation: 2063Reputation: 2063Reputation: 2063Reputation: 2063Reputation: 2063Reputation: 2063Reputation: 2063Reputation: 2063Reputation: 2063Reputation: 2063
Quote:
Originally Posted by andrewysk View Post
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".
 
Old 04-03-2021, 03:03 PM   #4
teckk
LQ Guru
 
Registered: Oct 2004
Distribution: Arch
Posts: 5,152
Blog Entries: 6

Rep: Reputation: 1835Reputation: 1835Reputation: 1835Reputation: 1835Reputation: 1835Reputation: 1835Reputation: 1835Reputation: 1835Reputation: 1835Reputation: 1835Reputation: 1835
Also look at:
man mount
man df
 
Old 04-03-2021, 03:40 PM   #5
Emerson
LQ Sage
 
Registered: Nov 2004
Location: Saint Amant, Acadiana
Distribution: Gentoo ~amd64
Posts: 7,665

Rep: Reputation: Disabled
Plain 'mount' command will list all mounted filesystems, you can grep it for /dev/sd to display only block devices.
 
Old 04-03-2021, 05:01 PM   #6
andrewysk
Member
 
Registered: Mar 2020
Posts: 797

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by jsbjsb001 View Post
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

Code:
$lsblk -f
sdc  ext4   1.0                0bbb1e48-3fd1-4865-9348-69b066c7d2ab   10,4G    59% /run/media
sdd  iso966       ISOIMAGE     2019-08-26-06-55-15-00                              
└─sdd1
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.

Last edited by andrewysk; 04-03-2021 at 05:03 PM.
 
Old 04-03-2021, 05:07 PM   #7
andrewysk
Member
 
Registered: Mar 2020
Posts: 797

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by Emerson View Post
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.

Thx
 
Old 04-03-2021, 05:27 PM   #8
andrewysk
Member
 
Registered: Mar 2020
Posts: 797

Original Poster
Rep: Reputation: Disabled
Code:
$ pmount /dev/sdd /mnt/supergrub2_bootdisk
Error: '/' must not occur in label name
Why pmount can't be use to mount ? since pmount is specificly design for portable usb storage
Code:
$ sudo mount /dev/sdd /mnt/supergrub2_bootdisk
mount: /mnt/supergrub2_bootdisk: WARNING: source write-protected, mounted read-only.
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
 
Old 04-03-2021, 05:50 PM   #9
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,784

Rep: Reputation: 5937Reputation: 5937Reputation: 5937Reputation: 5937Reputation: 5937Reputation: 5937Reputation: 5937Reputation: 5937Reputation: 5937Reputation: 5937Reputation: 5937
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.

Last edited by michaelk; 04-03-2021 at 05:54 PM.
 
Old 04-03-2021, 07:02 PM   #10
rnturn
Senior Member
 
Registered: Jan 2003
Location: Illinois (SW Chicago 'burbs)
Distribution: openSUSE, Raspbian, Slackware. Previous: MacOS, Red Hat, Coherent, Consensys SVR4.2, Tru64, Solaris
Posts: 2,818

Rep: Reputation: 550Reputation: 550Reputation: 550Reputation: 550Reputation: 550Reputation: 550
Quote:
Originally Posted by andrewysk View Post
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.



HTH...
 
2 members found this post helpful.
Old 04-03-2021, 08:25 PM   #11
computersavvy
Senior Member
 
Registered: Aug 2016
Posts: 3,345

Rep: Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484
Quote:
Originally Posted by andrewysk View Post
i

Code:
$lsblk -f
sdc  ext4   1.0                0bbb1e48-3fd1-4865-9348-69b066c7d2ab   10,4G    59% /run/media
sdd  iso966       ISOIMAGE     2019-08-26-06-55-15-00                              
└─sdd1
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
Code:
lsblk -f
NAME             FSTYPE            FSVER            LABEL                         UUID                                   FSAVAIL FSUSE% MOUNTPOINT

sdg              iso9660           Joliet Extension Fedora-WS-Live-34_B-1-3       2021-03-18-00-18-00-00                                
├─sdg1  iso9660         Joliet Extensio Fedora-WS-Live-34_B-1-3       2021-03-18-00-18-00-00                       0   100% /run/media/jvian/Fedora-WS-Live-34_B-1-3
├─sdg2           vfat              FAT16            ANACONDA                      C32E-7A2B                                             
└─sdg3           hfsplus                            ANACONDA                      7407b5c0-88ed-3099-9651-3f919f29dcba
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.
 
1 members found this post helpful.
Old 04-04-2021, 07:47 AM   #12
teckk
LQ Guru
 
Registered: Oct 2004
Distribution: Arch
Posts: 5,152
Blog Entries: 6

Rep: Reputation: 1835Reputation: 1835Reputation: 1835Reputation: 1835Reputation: 1835Reputation: 1835Reputation: 1835Reputation: 1835Reputation: 1835Reputation: 1835Reputation: 1835
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
 
Old 04-04-2021, 08:14 AM   #13
teckk
LQ Guru
 
Registered: Oct 2004
Distribution: Arch
Posts: 5,152
Blog Entries: 6

Rep: Reputation: 1835Reputation: 1835Reputation: 1835Reputation: 1835Reputation: 1835Reputation: 1835Reputation: 1835Reputation: 1835Reputation: 1835Reputation: 1835Reputation: 1835
cat /boot/grub/afdmsg.cfg
Code:
set saved_root=$root

echo "STUPID"
echo "LAINUX"
echo "TOY OS"
echo "DELETED!!!"
echo ""
echo "HA HA HA!"
echo "==--MFSTH4CK3R--=="
sleep 2
clear
echo "STUPID"
echo "LAINUX"
echo "TOY OS"
echo "DELETED!!!"
echo ""
echo " HA HA HA!"
echo "==--          --=="
sleep 2
clear
echo "STUPID"
echo "LAINUX"
echo "TOY OS"
echo "DELETED!!!"
echo ""
echo "A HA HA HA!"
echo "==--M S H C 3R--=="
clear
sleep 2
echo "STUPID"
echo "LAINUX"
echo "TOY OS"
echo "DELETED!!!"
echo ""
echo "HA HA HA HA!"
echo "==--MFSTH4CK3R--=="
sleep 5
clear
echo "Hi..."
echo ""
echo "Scared?"
echo "Huh?"
echo "..."
echo "Happy $YEAR Year April's Fools Day!"
echo ""
echo "Going into Super Grub2 Disk in 15 seconds ;)"
echo ""
echo "adrian15"
sleep 15


set root=$saved_root
configfile "${sg2d_directory}/main.cfg"
 
Old 04-04-2021, 08:27 AM   #14
colorpurple21859
LQ Veteran
 
Registered: Jan 2008
Location: florida panhandle
Distribution: Slackware Debian, Fedora, others
Posts: 7,396

Rep: Reputation: 1594Reputation: 1594Reputation: 1594Reputation: 1594Reputation: 1594Reputation: 1594Reputation: 1594Reputation: 1594Reputation: 1594Reputation: 1594Reputation: 1594
How did you put the iso onto the usb?
 
Old 04-04-2021, 05:57 PM   #15
andrewysk
Member
 
Registered: Mar 2020
Posts: 797

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by computersavvy View Post
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
Code:
lsblk -f
NAME             FSTYPE            FSVER            LABEL                         UUID                                   FSAVAIL FSUSE% MOUNTPOINT

sdg              iso9660           Joliet Extension Fedora-WS-Live-34_B-1-3       2021-03-18-00-18-00-00                                
├─sdg1  iso9660         Joliet Extensio Fedora-WS-Live-34_B-1-3       2021-03-18-00-18-00-00                       0   100% /run/media/jvian/Fedora-WS-Live-34_B-1-3
├─sdg2           vfat              FAT16            ANACONDA                      C32E-7A2B                                             
└─sdg3           hfsplus                            ANACONDA                      7407b5c0-88ed-3099-9651-3f919f29dcba
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 View Post
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 View Post
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 ?

OH boy! i am so confused!

Code:
lsblk -f
NAME FSTYPE FSVER LABEL        UUID                                 FSAVAIL FSUSE% MOUNTPOINT
                                          
sdb                                                                                
├─sdb1
│    ext4   1.0                e243610f-aeef-4cd0-8dea-3456638f11f6   33,2G    52% /
└─sdb2
     ext4   1.0                3a129912-a5a6-460e-965a-e3007b28ce2b  534,9G    31% /home
sdc  ext4   1.0                0bbb1e48-3fd1-4865-9348-69b066c7d2ab   10,4G    59% /run/media
sdd  iso966       ISOIMAGE     2019-08-26-06-55-15-00                              
└─sdd1
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Hard drive not detected when plugged into usb 3.0 port but ok on a usb 2.0 port on CentOS 6.4 centguy Linux - General 11 07-13-2017 08:22 PM
Ubunty 8.04 hangs when USB stick is plugged in sydney-troz Linux - Desktop 2 12-10-2008 03:40 PM
How to detect programatically if a USB device is is plugged-in / plugged out? franc Linux - Software 3 02-01-2007 04:01 AM
Un-plugged PS/2 mouse then plugged it into usb. mouse now dead deathman Mandriva 2 11-20-2006 07:35 AM
USB thumb drive corrupts whenever plugged into Linux, but not windows. RHLinuxGUY Linux - Hardware 1 08-12-2006 08:00 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 03:28 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration