LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   mkdir and mounting saying "special device does not exist" (https://www.linuxquestions.org/questions/linux-newbie-8/mkdir-and-mounting-saying-special-device-does-not-exist-4175637488/)

ironclads 08-30-2018 06:03 PM

mkdir and mounting saying "special device does not exist"
 
I'm pretty new, and yes, rusty since I haven't touched Linux in 10 years +. Through the command line, I'm creating a directory "icon_archive" off root using "mkdir /icon_archive". I'm adding this to /etc/fstab "icondir /icon_archive none defaults,bind 0 0". When I attempt to "mount icondir" it says "special device does not exist." Is this not the way I should go to create a shortcut as it were to the /icon_archive directory? I must be doing something wrong, but I've searched all over and it says basically the same or similar information. I don't remember needing to create a volume just so I can mount it and use it with the short name. Any thoughts for this newbie? Thank you.

Keith Hedger 08-30-2018 07:05 PM

fstab ojntz file systems, "icondir" is not a file system, the first entry on a line in fstab sbould either be a "/dev/" device node eg "/dev/sdb1" or a device label eg "bigdisk2" or a UUID.

you don't use the fstab file for shortcuts.

sgrlscz 08-31-2018 07:09 AM

Quote:

Originally Posted by ironclads (Post 5898217)
I'm pretty new, and yes, rusty since I haven't touched Linux in 10 years +. Through the command line, I'm creating a directory "icon_archive" off root using "mkdir /icon_archive". I'm adding this to /etc/fstab "icondir /icon_archive none defaults,bind 0 0". When I attempt to "mount icondir" it says "special device does not exist." Is this not the way I should go to create a shortcut as it were to the /icon_archive directory? I must be doing something wrong, but I've searched all over and it says basically the same or similar information. I don't remember needing to create a volume just so I can mount it and use it with the short name. Any thoughts for this newbie? Thank you.

To put a bind mount in fstab, you need to use full paths, otherwise it only works when you're in the parent directory.

The first entry should be the 'source' path and the second is the 'destination' path. For example,

Code:

/icondir  /icon_archive    none    bind    0  0
will mount /icondir to /icon_archive.

Quote:

Originally Posted by Keith Hedger (Post 5898235)
fstab ojntz file systems, "icondir" is not a file system, the first entry on a line in fstab sbould either be a "/dev/" device node eg "/dev/sdb1" or a device label eg "bigdisk2" or a UUID.

you don't use the fstab file for shortcuts.

He's doing a bind mount, which allows you to mount a directory to another name.

It's useful for keeping application files all on one file system, but mounting the various directories to standard system locations (e.g., /appl/config gets mounted to /etc/appl, /appl/db goes to /var/lib/appl, etc.).

Keith Hedger 08-31-2018 07:32 AM

Quote:

Originally Posted by sgrlscz (Post 5898360)
...
He's doing a bind mount, which allows you to mount a directory to another name.
...


whoops! my bad missed the 'bind' bit, sorry, must pay attention!

ironclads 08-31-2018 09:30 AM

Thank you...but still stuck
 
That helped...a little. It still says the same error message, but I then tried putting "/dev/icon_archive" and it said does not exist. I know the dir is "icon_archive" and it exists off the root. I can do a "cd icon_archive" and it changes to that dir. Is there some full path I need to put into the /etc/fstab file with this entry that I'm missing. Thank you again for the help.

hydrurga 08-31-2018 09:34 AM

Did you try the fstab line suggested by sgrlscz in post #3?

ironclads 08-31-2018 10:16 AM

Sure thing. I did, just as he wrote it. ;-) When I put in "/icondir /icon_archive none bind 0 0" into the /etc/fstab file, save, exit and type "mount /icondir", I get "mount: special device /icondir does not exist".
Quote:

# /etc/fstab
# Created by anaconda on Tue Aug 28 16:28:42 2018
#
# Accessible filesystems, by reference, are maintained under '/dev/disk'
# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info
#
/dev/mapper/vg00-rootlv00 / ext4 defaults 1 1
UUID=ee63723f-6a8c-4d53-a777-9a730f94b661 /boot ext4 defaults 1 2
/dev/mapper/vg00-optlv00 /opt ext4 defaults 1 2
/dev/mapper/vg00-softwarelv00 /software ext4 defaults 1 2
/dev/mapper/vg00-tmplv00 /tmp ext4 defaults 1 2
/dev/mapper/vg00-CernerESMlv00 /usr/cerneresm ext4 defaults 1 2
/dev/mapper/vg00-exportlv00 /usr1/EXPORT ext4 defaults 1 2
/dev/mapper/vg00-varlv00 /var ext4 defaults 1 2
/dev/mapper/vg00-varimagedevlv00 /var/imagedev ext4 defaults 1 2
/dev/mapper/vg00-swaplv00 swap swap defaults 0 0
tmpfs /dev/shm tmpfs defaults 0 0
devpts /dev/pts devpts gid=5,mode=620 0 0
sysfs /sys sysfs defaults 0 0
proc /proc proc defaults 0 0
/icondir /icon_archive none bind 0 0

hydrurga 08-31-2018 10:23 AM

Once you've created fstab, sudo mount -a tries to mount everything according to the info you've specified in it. That's the way you'll see if it works.

Edit: removed incorrect info - see below.

ironclads 08-31-2018 11:02 AM

Sorry. I've tried this too and it doesn't work. Gives the same error.

michaelk 08-31-2018 11:03 AM

Quote:

The mount command by itself is not aware of fstab.
Yes it is... From the man pages

Quote:

When mounting a filesystem mentioned in fstab or mtab, it suffices to give only the device, or only the mount point.

What happens when you try it from the command line?

mount --bind /icondir /icon_archive

What distribution / version are you running?

hydrurga 08-31-2018 11:05 AM

Quote:

Originally Posted by michaelk (Post 5898419)
Yes it is... From the man pages

My apologies. I stand corrected.

michaelk 08-31-2018 11:14 AM

:)

As stated above /icondir is the source directory. I forgot to ask if you the path is correct.

ironclads 08-31-2018 11:46 AM

Firstly, icondir doesn't actually exist anywhere. It is a shortcut name pointing to, or rather, that I'm attempting to point to "/icon_archive" which does exist off root. I've tried "icondir" and "/icondir" in the etc/fstab file. All give "special device does not exist. I've tried "mount --bind /icondir /icon_archive" and that too gives the same error. I've also tried "mount --bind icondir /icon_archive" and that too does the same thing.

From command line, I type: "cat /etc/redhat-release" I get "Red Hat Enterprise Linux Server release 6.9 (Santiago)"

I did actually create the "icondir" directory using mkdir and then these commands work. I don't really want to create a new directory, just another name/shortcut for the "/icon_archive" directory.

Thank you again.

sgrlscz 08-31-2018 12:15 PM

Quote:

Originally Posted by ironclads (Post 5898448)
Firstly, icondir doesn't actually exist anywhere. It is a shortcut name pointing to, or rather, that I'm attempting to point to "/icon_archive" which does exist off root. I've tried "icondir" and "/icondir" in the etc/fstab file. All give "special device does not exist. I've tried "mount --bind /icondir /icon_archive" and that too gives the same error. I've also tried "mount --bind icondir /icon_archive" and that too does the same thing.

From command line, I type: "cat /etc/redhat-release" I get "Red Hat Enterprise Linux Server release 6.9 (Santiago)"

I did actually create the "icondir" directory using mkdir and then these commands work. I don't really want to create a new directory, just another name/shortcut for the "/icon_archive" directory.

Thank you again.

Mount doesn't work that way. For any mount, both the source and the destination must exist.

Also, what you actually did was mount /icondir over /icon_archive. In that case, if /icon_archive contained anything, it would be hidden. That is the opposite of what you seem to be trying to accomplish. Source is where things are now, destination is where you want them to appear. So, your source is /icon_archive, and your destination is /icondir.

You can create a symbolic link /icondir to point to /icon_archive:

Code:

ln -s /icon_archive /icondir

ironclads 08-31-2018 12:20 PM

Um...ok. That worked. So is this permanent or will it be reset upon reboot? If so, how do I get it to always point correctly? Again, thank you all for your help. Boy its fun being a newbie. ;-)


All times are GMT -5. The time now is 10:33 AM.