|
Home | Switchboard | Unix Administration | Red Hat | TCP/IP Networks | Neoliberalism | Toxic Managers |
(slightly skeptical) Educational society promoting "Back to basics" movement against IT overcomplexity and bastardization of classic Unix |
News | Device mapper | Partition labels | ||||
Logical Volume Manager (LVM) | Admin Horror Stories | Humor | Etc |
|
Linux has mind boggling variety of disk mapping schemes. Among them
By-ID mapping is one of the function of device mapper. It leads to persistent device names but also prevents booting a cloned system (e.g. a dd'ed system) out-of-the-box. Partitions are numbered sequentially with this scheme and repartitioning changes it.
The device-mapper is a Linux kernel component introduced in kernel 2.6 that permits mapping one block device onto another. It is used in such subsystems as
|
Switchboard | ||||
Latest | |||||
Past week | |||||
Past month |
|
Where's the difference between mounting partitions by-ID and by-UUID?
Since version 10 of SLES/SLED and since 10.3 of OpenSUSE (IIRC), fstab and grub's menu.lst no longer contain device-names but device IDs (as pointed out in New default in SLES/SLED 10 SP1: mount "by Device ID").
This by-ID-way leads to persistent device names but also prevents booting a cloned system (e.g. a dd'ed system) out-of-the-box. Using by-UUID would solve this problem, but none of the docs I found about imaging+by-ID recommend this way. Almost all recommend using the old-fashioned /dev/sdX. Why not using UUID? Has anybody a clue?
nibuild wrote:
> Where's the difference between mounting partitions by-ID and by-UUID?
>
> Since version 10 of SLES/SLED and since 10.3 of OpenSUSE (IIRC), fstab
> and grub's menu.lst no longer contain device-names but device IDs (as
> pointed out in 'New default in SLES/SLED 10 SP1: mount \"by Device ID\"'
> (http://tinyurl.com/5dmgf7)).
>
> This by-ID-way leads to persistent device names but also prevents
> booting a cloned system (e.g. a dd'ed system) out-of-the-box. Using
> by-UUID would solve this problem, but none of the docs I found about
> imaging+by-ID recommend this way. Almost all recommend using the
> old-fashioned /dev/sdX. Why not using UUID? Has anybody a clue?
>
>In theory I suppose a uuid that is saved could be chunked forcing the creation of a new uuid.
As you mentioned, by-id usually involves something more intrinsic inside the drive itself (thus preventing "cloning").
My abstraction of choice where possible is using LVM.
On Linux Today's post is about something I think is pretty cool on Linux (since about kernel 2.1.x, when /proc/partitions was introduced, or made standard). It has to do with disk mounting (both on the command line or through the fstab) by UUID (Universal Unique Identifier). UUID notation, when used as a means to access disk, is just one more way that Linux has moved ahead of the pack to (depending on your way of thinking ;) either make disk management more accessible or make the fstab and disk identification even more confusing ;) NOTE: Skip the next paragraph if you don't care about Open Solaris' slight support for this functionality, to date. Skip to the numbered list if you just want to check out the commands and have had your fair share of my opinion ;)
For those of you who got here by catching the Solaris and Unix tags on this post, I want to address your concerns immediately, since you may no longer be concerned with this text after the next few sentences ;) Although Solaris does "understand" UUID addressing, the level on which Solaris addresses the issue (with regards to disk management) isn't user-friendly enough to fit in the scope of this post. Basically, and this is putting it very generically, the getting and setting of object UUID's on Solaris is still only resident at the code-base layer. I'm glad to see that Sun is addressing the issue with C functions like wsreg_set_id() and wsreg_get_id(), but, since the functionality provided by this layer of access hasn't been implemented in any relevant user tools, we won't be looking at Solaris' implementation of it for the remainder of this dialogue. Ok, I'll give Solaris 10 points for having expanded greatly upon the previous version's acceptance of the standard by implementing a lot of new C routines, a "makeuuid" binary and support for UUID's of zones, but, again, since we're going to be looking at mounting disk using the UUID (without re-writing the OS), Solaris (Open and Regular) is out for now (8/20/2008 just in case the future makes me incorrect, which it has a nasty habit of doing ;)
While Linux boasts most of the same C routines and headers as Solaris (which it must, of course, since the OS supports UUID identification), they're named slightly differently and - the biggest plus - Linux (RedHat and Ubuntu, at least) come with plenty of programs to work with disk UUID's and plenty of hooks to allow other programs to make use of the disk UUID's as well!
The most basic program (that Solaris has picked up on) is called "uuidgen." This program will generate a UUID for you based on the output from a decent randomness-generator (like /dev/random) or resort to time-and-MAC-based randomization ( Generally, the only random factor used is time, unless you have the privilege to view your ethernet adapter's MAC address). The program can be forced to use one or the other, if you have a specific preference (with the "-r" and "-t" flags, respectively). This seemingly extraneous program does have one very important area of application, which we'll look at below.
Where you really see the benefit with Linux is in how they've worked it into their basic hard disk management facilities. They've made it very simple for you to keep track of your disks by UUID using any number of methods. I'll be listing several different means to some "ends" you may want to achieve, as every command may not be available in your Linux distro, but at least one probably is.
One, often unmentioned (but highly valuable), benefit of using UUID's to deal with your disks is that you don't have to worry about system naming conventions and the hassles inherent with using them. For instance, if you have a disk with a specific UUID and a block device name of /dev/sda3, if you do all your work (and system/application customization) with that disk, as the name /dev/sda3, you might be in for a big headache if you have a system problem (or just install some new hardware and reconfigure) and Linux decides to rename /dev/sda3 as /dev/sdb3 (or "anything" else). If you're using UUID's, you can simply use the "tune2fs" command (shown below) to assign the original UUID back to the new logical device name, so /dev/sdb3 would function exactly as if it were /dev/sda3, without causing any issues with your Linux OS :):
1. If you don't know the UUID of your disk, you can find it by using one of the several commands below:
host # vol_id /dev/sda3
...
ID_FS_UUID=a1331d73-d640-4bac-97b4-cf33a375ae5b
...or:
host # blkid /dev/sda3 <-- Leave blank to show all disks
/dev/sda3: LABEL="/" UUID="a1331d73-d640-4bac-97b4-cf33a375ae5b" SEC_TYPE="ext3" TYPE="ext2"also:
host # ls -l /dev/disk/by-uuid|grep sda3
lrwxrwxrwx 1 root root 10 11. Okt 18:02 a1331d73-d640-4bac-97b4-cf33a375ae5b-> ../../sda32. If you prefer to generate your own UUID's (see above), you can use the uuidgen command and couple it with tune2fs to change the default UUID assigned to your disk by the system, like this:
host # uuidgen
1d721189-7b71-4315-95a7-1c3abc90d379
host # tune2fs -U 1d721189-7b71-4315-95a7-1c3abc90d379 /dev/sda33. Then again, if you already know the UUID, you might want to find out what disk it's associated with. You can generally get this information with the "findfs" command, like so:
host # findfs UUID=a1331d73-d640-4bac-97b4-cf33a375ae5b
/dev/sda3Of course, using some of the commands above and grepping out part of the UUID will also get you your answer, like:
host # ls -l /dev/disk/by-uuid|grep a1331d73-d640-4bac-97b4-cf33a375ae5b
lrwxrwxrwx 1 root root 10 11. Okt 18:02 a1331d73-d640-4bac-97b4-cf33a375ae5b-> ../../sda3or
host # blkid|grep a1331d73-d640-4bac-97b4-cf33a375ae5b <-- remember that blkid with no arguments returns all of the system disk
/dev/sda3: LABEL="/" UUID="a1331d73-d640-4bac-97b4-cf33a375ae5b" SEC_TYPE="ext3" TYPE="ext2"4. And, lastly (for this post, at least ;), you can mount your disks using the UUID, and even incorporate that automated UUID mounting into your /etc/fstab. To mount directly from the command line, you can do something like this:
host # mount -U a1331d73-d640-4bac-97b4-cf33a375ae5b /directory/you/mount/this/disk/on
and you could instruct your system to mount this partition by UUID from within the fstab, as well. It works basically the same way that the LABEL keyword does:
host # cat /etc/fstabAnd, at this point, you should be able to figure your way around using UUID's to manipulate your disk on Linux with no problem. Enjoy, and please "be careful" :)
...
UUID=a1331d73-d640-4bac-97b4-cf33a375ae5b /directory/you/mount/this/disk/on ext3fs defaults 1 1
Society
Groupthink : Two Party System as Polyarchy : Corruption of Regulators : Bureaucracies : Understanding Micromanagers and Control Freaks : Toxic Managers : Harvard Mafia : Diplomatic Communication : Surviving a Bad Performance Review : Insufficient Retirement Funds as Immanent Problem of Neoliberal Regime : PseudoScience : Who Rules America : Neoliberalism : The Iron Law of Oligarchy : Libertarian Philosophy
Quotes
War and Peace : Skeptical Finance : John Kenneth Galbraith :Talleyrand : Oscar Wilde : Otto Von Bismarck : Keynes : George Carlin : Skeptics : Propaganda : SE quotes : Language Design and Programming Quotes : Random IT-related quotes : Somerset Maugham : Marcus Aurelius : Kurt Vonnegut : Eric Hoffer : Winston Churchill : Napoleon Bonaparte : Ambrose Bierce : Bernard Shaw : Mark Twain Quotes
Bulletin:
Vol 25, No.12 (December, 2013) Rational Fools vs. Efficient Crooks The efficient markets hypothesis : Political Skeptic Bulletin, 2013 : Unemployment Bulletin, 2010 : Vol 23, No.10 (October, 2011) An observation about corporate security departments : Slightly Skeptical Euromaydan Chronicles, June 2014 : Greenspan legacy bulletin, 2008 : Vol 25, No.10 (October, 2013) Cryptolocker Trojan (Win32/Crilock.A) : Vol 25, No.08 (August, 2013) Cloud providers as intelligence collection hubs : Financial Humor Bulletin, 2010 : Inequality Bulletin, 2009 : Financial Humor Bulletin, 2008 : Copyleft Problems Bulletin, 2004 : Financial Humor Bulletin, 2011 : Energy Bulletin, 2010 : Malware Protection Bulletin, 2010 : Vol 26, No.1 (January, 2013) Object-Oriented Cult : Political Skeptic Bulletin, 2011 : Vol 23, No.11 (November, 2011) Softpanorama classification of sysadmin horror stories : Vol 25, No.05 (May, 2013) Corporate bullshit as a communication method : Vol 25, No.06 (June, 2013) A Note on the Relationship of Brooks Law and Conway Law
History:
Fifty glorious years (1950-2000): the triumph of the US computer engineering : Donald Knuth : TAoCP and its Influence of Computer Science : Richard Stallman : Linus Torvalds : Larry Wall : John K. Ousterhout : CTSS : Multix OS Unix History : Unix shell history : VI editor : History of pipes concept : Solaris : MS DOS : Programming Languages History : PL/1 : Simula 67 : C : History of GCC development : Scripting Languages : Perl history : OS History : Mail : DNS : SSH : CPU Instruction Sets : SPARC systems 1987-2006 : Norton Commander : Norton Utilities : Norton Ghost : Frontpage history : Malware Defense History : GNU Screen : OSS early history
Classic books:
The Peter Principle : Parkinson Law : 1984 : The Mythical Man-Month : How to Solve It by George Polya : The Art of Computer Programming : The Elements of Programming Style : The Unix Hater’s Handbook : The Jargon file : The True Believer : Programming Pearls : The Good Soldier Svejk : The Power Elite
Most popular humor pages:
Manifest of the Softpanorama IT Slacker Society : Ten Commandments of the IT Slackers Society : Computer Humor Collection : BSD Logo Story : The Cuckoo's Egg : IT Slang : C++ Humor : ARE YOU A BBS ADDICT? : The Perl Purity Test : Object oriented programmers of all nations : Financial Humor : Financial Humor Bulletin, 2008 : Financial Humor Bulletin, 2010 : The Most Comprehensive Collection of Editor-related Humor : Programming Language Humor : Goldman Sachs related humor : Greenspan humor : C Humor : Scripting Humor : Real Programmers Humor : Web Humor : GPL-related Humor : OFM Humor : Politically Incorrect Humor : IDS Humor : "Linux Sucks" Humor : Russian Musical Humor : Best Russian Programmer Humor : Microsoft plans to buy Catholic Church : Richard Stallman Related Humor : Admin Humor : Perl-related Humor : Linus Torvalds Related humor : PseudoScience Related Humor : Networking Humor : Shell Humor : Financial Humor Bulletin, 2011 : Financial Humor Bulletin, 2012 : Financial Humor Bulletin, 2013 : Java Humor : Software Engineering Humor : Sun Solaris Related Humor : Education Humor : IBM Humor : Assembler-related Humor : VIM Humor : Computer Viruses Humor : Bright tomorrow is rescheduled to a day after tomorrow : Classic Computer Humor
The Last but not Least Technology is dominated by two types of people: those who understand what they do not manage and those who manage what they do not understand ~Archibald Putt. Ph.D
Copyright © 1996-2021 by Softpanorama Society. www.softpanorama.org was initially created as a service to the (now defunct) UN Sustainable Development Networking Programme (SDNP) without any remuneration. This document is an industrial compilation designed and created exclusively for educational use and is distributed under the Softpanorama Content License. Original materials copyright belong to respective owners. Quotes are made for educational purposes only in compliance with the fair use doctrine.
FAIR USE NOTICE This site contains copyrighted material the use of which has not always been specifically authorized by the copyright owner. We are making such material available to advance understanding of computer science, IT technology, economic, scientific, and social issues. We believe this constitutes a 'fair use' of any such copyrighted material as provided by section 107 of the US Copyright Law according to which such material can be distributed without profit exclusively for research and educational purposes.
This is a Spartan WHYFF (We Help You For Free) site written by people for whom English is not a native language. Grammar and spelling errors should be expected. The site contain some broken links as it develops like a living tree...
|
You can use PayPal to to buy a cup of coffee for authors of this site |
Disclaimer:
The statements, views and opinions presented on this web page are those of the author (or referenced source) and are not endorsed by, nor do they necessarily reflect, the opinions of the Softpanorama society. We do not warrant the correctness of the information provided or its fitness for any purpose. The site uses AdSense so you need to be aware of Google privacy policy. You you do not want to be tracked by Google please disable Javascript for this site. This site is perfectly usable without Javascript.
Last modified: March, 12, 2019