<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[linux: UUID einer gemounteten Partition feststellen]]></title><description><![CDATA[<p>Hi,</p>
<p>angenommen ich habe in /path/to/mounted eine partition gemountet; wie finde ich am schnellsten aus einem bash skript, was die UUID der partition ist?</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/260891/linux-uuid-einer-gemounteten-partition-feststellen</link><generator>RSS for Node</generator><lastBuildDate>Sun, 26 Apr 2026 16:51:03 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/260891.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 10 Feb 2010 14:00:24 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to linux: UUID einer gemounteten Partition feststellen on Wed, 10 Feb 2010 14:00:24 GMT]]></title><description><![CDATA[<p>Hi,</p>
<p>angenommen ich habe in /path/to/mounted eine partition gemountet; wie finde ich am schnellsten aus einem bash skript, was die UUID der partition ist?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1853630</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1853630</guid><dc:creator><![CDATA[you you ei dee]]></dc:creator><pubDate>Wed, 10 Feb 2010 14:00:24 GMT</pubDate></item><item><title><![CDATA[Reply to linux: UUID einer gemounteten Partition feststellen on Wed, 10 Feb 2010 14:24:40 GMT]]></title><description><![CDATA[<p>Weiß nicht, ob das auch eleganter geht, aber Du könntest auf alle Fälle checken, wohin die Links in /dev/disk/by-uuid/ gehen und ob einer davon der gesuchten Partition entspricht.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1853645</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1853645</guid><dc:creator><![CDATA[nman]]></dc:creator><pubDate>Wed, 10 Feb 2010 14:24:40 GMT</pubDate></item><item><title><![CDATA[Reply to linux: UUID einer gemounteten Partition feststellen on Wed, 10 Feb 2010 14:29:30 GMT]]></title><description><![CDATA[<pre><code>ls -l /dev/disk/by-id/ |grep `mount | grep '/hier/der/pfad/zum/mount' | cut -f3 -d\/ | cut -f1 -d\ `
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1853651</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1853651</guid><dc:creator><![CDATA[SeppJ]]></dc:creator><pubDate>Wed, 10 Feb 2010 14:29:30 GMT</pubDate></item><item><title><![CDATA[Reply to linux: UUID einer gemounteten Partition feststellen on Wed, 10 Feb 2010 15:40:05 GMT]]></title><description><![CDATA[<p>SeppJ schrieb:</p>
<blockquote>
<pre><code>ls -l /dev/disk/by-id/ |grep `mount | grep '/hier/der/pfad/zum/mount' | cut -f3 -d\/ | cut -f1 -d\ `
</code></pre>
</blockquote>
<p>Das ist nicht unbedingt robust: Das grep-Pattern könnte alles mögliche matchen, das ist nicht eingeschränkt aufs richtige Feld und auch nicht eingeschränkt auf &quot;vollständiges match&quot;. Es könnte z.B. ein Prefix oder Suffix matchen statt des gewünschten Pfads, oder ein ganz anderes Feld in der Ausgabe von mount.</p>
<p>Eine elegante Methode kenn ich auch nicht. Man könnte die gezeigte Methode vielleicht ein bisschen sicherer machen, wenn man nicht Pfade, sondern inode-Nummern vergleicht. Ob zwei Pfade identisch sind, ist nicht so einfach festzustellen, aber für zwei inode-Nummern ist das sehr einfach.</p>
<p>Das könnte dann so in der Art aussehen:</p>
<pre><code>find_uuid() {
  local DEVICE_INODE=$(/usr/bin/stat -c '%i' $(grep &quot;^[^ ]* $1 &quot; /etc/mtab | cut -d ' ' -f 1))
  local INODE_UUID=$(ls -Li1 /dev/disk/by-uuid | grep &quot;^ *$DEVICE_INODE &quot;)
  echo ${INODE_UUID##* }
}
</code></pre>
<p>Die Funktion wird so aufgerufen:</p>
<pre><code>find_uuid /pfad/zum/mount
</code></pre>
<p>Allerdings geht diese Funktion ziemlich sicher auch schief, wenn der mount-pfad Leerzeichen enthält.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1853674</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1853674</guid><dc:creator><![CDATA[Christoph]]></dc:creator><pubDate>Wed, 10 Feb 2010 15:40:05 GMT</pubDate></item><item><title><![CDATA[Reply to linux: UUID einer gemounteten Partition feststellen on Thu, 11 Feb 2010 23:11:20 GMT]]></title><description><![CDATA[<p>Christoph schrieb:</p>
<blockquote>
<p>...</p>
</blockquote>
<p><img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f44d.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--thumbs_up"
      title=":+1:"
      alt="👍"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1854444</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1854444</guid><dc:creator><![CDATA[you you ei dee]]></dc:creator><pubDate>Thu, 11 Feb 2010 23:11:20 GMT</pubDate></item></channel></rss>