LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
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 01-21-2008, 12:05 AM   #1
amn
LQ Newbie
 
Registered: Mar 2007
Posts: 17

Rep: Reputation: 0
Mounting partition(s) by label - Reboot required??


Hi all,

After googling around I start to come to the fact that there are areas Linux requires reboot, just as Windows regrettably does.

Which it should not have to IMO. Anyways, here are details...

I labeled a newly created ext3 partition like this:

Code:
mkfs -V -t ext3 -v -j -L my-root /dev/sda10
and then immediately (it's all part of an automated script) do:

Code:
mount -v -L my-root /mnt/my-root
Note that /mnt/my-root has been installed earlier, so no problem there. The problem is it says in response to mount request:

Code:
mount: special device /dev/disk/by-label/my-root does not exist
'blkid /dev/sda10' shows that it indeed has the 'my-root' label assigned to it, but 'ls /dev/disk/by-label/*' does not show any file named 'my-root'. Googling revealed that a reboot is required before the label(s) just created are truly available to the system.

Is there any command that can do the same thing reboot would do, effectively bringing the label(s) to immediate availability? I am sure upon rebooting, there is some logic that re-reads labels or something.

Its all a script, this thing of mine, and I don't want to do any logic that will continue from reboot or anything. This smells Windows.....

Last edited by amn; 01-21-2008 at 12:06 AM.
 
Old 01-21-2008, 12:51 AM   #2
BASHCuresCancer
LQ Newbie
 
Registered: Jan 2008
Posts: 19

Rep: Reputation: 0
While not exactly sure, I would guess that a reboot or at least a mounting of the device would be required before the /dev file system would be updated. This is a relatively new "feature" that actually I did not even know about until I read this post.

None the less, there is another solution. You can mount the file system with the device name, which it appears you have since you are creating the file systems. Like so:

Code:
mkfs -V -t ext3 -v -j -L my-root /dev/sda10
mount -v /dev/sda10 /mnt/my-root
 
Old 01-21-2008, 07:36 AM   #3
lambchops468
Member
 
Registered: Mar 2007
Location: New Jersey, USA
Distribution: Archlinux
Posts: 165

Rep: Reputation: 30
I'm just guessing blindly...but since udev controls the device nodes in /dev, maybe you should try and restart udev?

Find out how to restart udev in your distro. There's probably some script in /etc/init.d
 
Old 01-21-2008, 11:39 PM   #4
amn
LQ Newbie
 
Registered: Mar 2007
Posts: 17

Original Poster
Rep: Reputation: 0
Mounting by device name is exactly what I am trying to avoid.

Restarting udev might be a very good idea...

I have another solution though, i did not test it yet, but i observed the following: the files in /dev/disk/by-label are symlinks to device name files (as in /dev/hda1 etc) so i just create symlinks and later when i don't need them i remove them, since /dev is not on disk. I am not sure whether it will work though...
 
Old 01-22-2008, 06:15 PM   #5
lambchops468
Member
 
Registered: Mar 2007
Location: New Jersey, USA
Distribution: Archlinux
Posts: 165

Rep: Reputation: 30
well...when you reboot (if you ever do), i think those symlinks will be gone.
 
Old 01-23-2008, 05:37 AM   #6
amn
LQ Newbie
 
Registered: Mar 2007
Posts: 17

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by lambchops468 View Post
well...when you reboot (if you ever do), i think those symlinks will be gone.
Well, if I reboot after doing creating partitions with labels assigned, symlinks may be gone but will reappear because udev will put them there after enumerating labelled partitions. Thats the point, because after doing "mkfs -t ext3 -L some_label" symlinks ARE supposed to be there, but are not, because a reboot is required (arguably restarting udev may do the trick, which i havent tried yet).
 
Old 02-28-2008, 12:39 PM   #7
archtoad6
Senior Member
 
Registered: Oct 2004
Location: Houston, TX (usa)
Distribution: MEPIS, Debian, Knoppix,
Posts: 4,727
Blog Entries: 15

Rep: Reputation: 231Reputation: 231Reputation: 231
Did you find a solution?

What worked?
 
Old 02-29-2008, 07:08 AM   #8
amn
LQ Newbie
 
Registered: Mar 2007
Posts: 17

Original Poster
Rep: Reputation: 0
Wink Create symlinks yourself

Yes, I did. It is not the most elegant one, but it's quite ok i guess.

What I did was to inspect how the mount by label really works. It turned out it looks for symlinks in /dev/disk/by-label that point to real device nodes in /dev/. So all I had to do after creating partition labels and before reboot, was to create these symlinks, as apparently, they would not appear until next boot. For instance i had a partition labelled "temp". I did ln -s /dev/sda8 /dev/disk/by-label/temp (dont remember exact switches now).

It all worked after these commands.


The only possible problem i see is whether these links I manually created are going to remain there and pollute the /dev filesystem. In case of dev residing in memory, i guess it's not a big deal, but with old fashioned MAKEDEV /dev systems, its on disk, hence my symlinks will stay until removed again. So i do remove them when i no longer need them, since it was a script that needed them, when the script cleans up after itself, it removes these links. Apparently the links that are created by system itself for labelled partitions are of the same sort as those i created manually.
 
Old 03-03-2008, 10:02 AM   #9
archtoad6
Senior Member
 
Registered: Oct 2004
Location: Houston, TX (usa)
Distribution: MEPIS, Debian, Knoppix,
Posts: 4,727
Blog Entries: 15

Rep: Reputation: 231Reputation: 231Reputation: 231
Recap
The key thing you had to do was label the partitions. Then the necessary symlinks would be (re-)created at the next (& all subsequent) reboot(s).

However, you needed the symlinks before rebooting, so you created them "manually"; actually, w/ a script.

Because you were not certain that these symlinks would not cause problems after reboot, you "manually" removed them, again w/ a script.


Unresolved
Was the removal of those symlinks necessary? --
Would they, in fact, have caused problems, or would the system have taken them in stride?
 
Old 03-04-2008, 08:29 AM   #10
amn
LQ Newbie
 
Registered: Mar 2007
Posts: 17

Original Poster
Rep: Reputation: 0
Too early to say now. Have to do more testing to find out. So far no side effects, as long as you remove the manually created links yourself as soon as you no longer require them.
 
Old 03-04-2008, 09:31 AM   #11
archtoad6
Senior Member
 
Registered: Oct 2004
Location: Houston, TX (usa)
Distribution: MEPIS, Debian, Knoppix,
Posts: 4,727
Blog Entries: 15

Rep: Reputation: 231Reputation: 231Reputation: 231
What I'm curious about is: What happens if you DON'T remove them?
 
Old 03-20-2008, 05:01 AM   #12
archtoad6
Senior Member
 
Registered: Oct 2004
Location: Houston, TX (usa)
Distribution: MEPIS, Debian, Knoppix,
Posts: 4,727
Blog Entries: 15

Rep: Reputation: 231Reputation: 231Reputation: 231
Did you ever do any further testing? -- I'm still very curious about what happens if you DON'T remove them.
 
Old 03-20-2008, 11:16 PM   #13
amn
LQ Newbie
 
Registered: Mar 2007
Posts: 17

Original Poster
Rep: Reputation: 0
Sorry, did not do that yet. I am stuck with a stupid Windows box. Hope i will finally switch over to Linux permanently. Windows is as addictive as crack, and just as lethal %)
 
Old 05-07-2010, 05:22 PM   #14
mbr
LQ Newbie
 
Registered: May 2010
Posts: 3

Rep: Reputation: 0
Cool

Quote:
Originally Posted by amn View Post
Is there any command that can do the same thing reboot would do, effectively bringing the label(s) to immediate availability? I am sure upon rebooting, there is some logic that re-reads labels or something.
Try this:
Code:
sudo udevtrigger --verbose
 
Old 05-10-2010, 08:26 AM   #15
archtoad6
Senior Member
 
Registered: Oct 2004
Location: Houston, TX (usa)
Distribution: MEPIS, Debian, Knoppix,
Posts: 4,727
Blog Entries: 15

Rep: Reputation: 231Reputation: 231Reputation: 231
Code:
~# aptitude search udevtrigger
~#
Where do I find udevtrigger?

I'm running MEPIS 8.0.15, KDE 3.5.10, kernel 2.6.27-1-mepis-smp.
 
  


Reply

Tags
label, mount, partition, reboot, udev


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
mounting partitions by label OldAl Ubuntu 6 05-14-2010 07:49 PM
Root Authentication required for reboot (and shutdown?) Guitarist88 Linux - General 2 02-28-2007 11:04 PM
How to LABEL Swap partition badrat Linux - Certification 4 10-19-2006 10:33 PM
Root Authorization Required to Reboot and Shutdown rioch Linux - Desktop 2 09-14-2006 09:43 AM
How can I rename the LABEL on my partition xkape Linux - General 3 01-18-2006 02:49 PM


All times are GMT -5. The time now is 05:34 AM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration