LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices

Reply
 
LinkBack Search this Thread
Old 10-20-2008, 05:43 PM   #1
jackpal
Member
 
Registered: Oct 2003
Location: Florida USA
Distribution: Fedora, RHEL
Posts: 57

Rep: Reputation: 15
Label to partition association


If I come across a system that uses a label in /etc/fstab instead of a device like /dev/sda1 how do I go about finding out which label is associated with which partition. For instance in an /etc/fstab there is a line like this:

Label=/logs /var/log ext3 defaults 1 2

How do I go about finding out exactly which partition on the disk is associated with that label ? Is there a map kept someplace ?
 
Old 10-20-2008, 05:46 PM   #2
darthaxul
Member
 
Registered: Aug 2008
Distribution: Gentoo; FreeBSD
Posts: 195

Rep: Reputation: 18
that is strange

I never seen that before
try
stat /dev/disk/by-label//logs/var/log
 
Old 10-20-2008, 06:19 PM   #3
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 11,792

Rep: Reputation: 923Reputation: 923Reputation: 923Reputation: 923Reputation: 923Reputation: 923Reputation: 923Reputation: 923
"ls -al /dev/disk/by-label" - by-uuid works similarly if you happen to be unfortunate enough to stumble across that.
 
Old 10-20-2008, 06:57 PM   #4
jschiwal
Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 654Reputation: 654Reputation: 654Reputation: 654Reputation: 654Reputation: 654
The forward slash doesn't look like a legal character. However by mounting by label or uuid, the fstab entry will be valid even if you repartition the drive, or if the device is external and gets a different device node the next time you plug it in.

You can get the label, uuid and filesystem information using the "udevinfo" program. You don't need to run it as root.
For example, if you what the information for the device & filesystem for /dev/sda5:
udevinfo -q env -n /dev/sda5

There are other options besides (-n) such as for using the /sys/ filesystem, the that type of query doesn't use the /sys/ part of the directory name so tab completion doesn't work.
 
Old 10-20-2008, 08:37 PM   #5
jackpal
Member
 
Registered: Oct 2003
Location: Florida USA
Distribution: Fedora, RHEL
Posts: 57

Original Poster
Rep: Reputation: 15
Thanks. unfortunately the machine I am working with does not have udevinfo (udev) installed. However I believe tune2fs should work in this fashion:

[root@esx7 root]# tune2fs -l /dev/sda1
tune2fs 1.32 (09-Nov-2002)
Filesystem volume name: /boot
Last mounted on: <not available>
Filesystem UUID: eb1cfd0f-4f0a-4994-8ad2-eabbff766bb3
Filesystem magic number: 0xEF53
Filesystem revision #: 1 (dynamic)
Filesystem features: has_journal filetype needs_recovery sparse_super
Default mount options: (none)
Filesystem state: clean
Errors behavior: Continue
Filesystem OS type: Linux
Inode count: 26104
Block count: 104391
Reserved block count: 5219
Free blocks: 75027
Free inodes: 26070
First block: 1
Block size: 1024
Fragment size: 1024
Blocks per group: 8192
Fragments per group: 8192
Inodes per group: 2008
Inode blocks per group: 251
Filesystem created: Sun Feb 10 03:10:52 2008
Last mount time: Mon Oct 20 18:18:55 2008
Last write time: Mon Oct 20 18:18:55 2008
Mount count: 71
Maximum mount count: -1
Last checked: Sun Feb 10 03:10:52 2008
Check interval: 0 (<none>)
Reserved blocks uid: 0 (user root)
Reserved blocks gid: 0 (group root)
First inode: 11
Inode size: 128
Journal UUID: <none>
Journal inode: 8
Journal device: 0x0000
First orphan inode: 0
 
Old 10-21-2008, 02:41 AM   #6
jschiwal
Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 654Reputation: 654Reputation: 654Reputation: 654Reputation: 654Reputation: 654
If you don't have udev installed, then the /dev/disk/by-* links won't be created either and you need to stick to the normally named devices instead of auto created links to then same devices. The udevd daemon is what auto creates the device links.
 
  


Reply

Tags
filesystems


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 On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Why won't testdisk let me label partition as extended? CJS Linux - General 10 11-21-2010 09:16 PM
fdisk : how to label a partition? concoran Linux - Newbie 6 04-06-2009 11:39 AM
Changing Partition Label on Ext3 carlosinfl Linux - General 5 04-12-2008 03:18 AM
How to LABEL Swap partition badrat Linux - Certification 4 10-19-2006 10:33 PM
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:23 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