天天看點

如何修改linux磁盤的uuid

<code>删除資料盤并再度分區和格式化後,重新開機會報錯,此時如何解決問題?</code>

<code>1)得到uuid </code>

<code> </code> 

<code># blkid /dev/sdb1</code>

<code>/dev/sdb1</code><code>: UUID=</code><code>"294c8a0c-86e1-441f-8e5a-df5a4fc4585a"</code> <code>TYPE=</code><code>"ext4"</code> 

<code>或</code>

<code># ls -l /dev/disk/by-uuid/ |grep sdb</code>

<code>lrwxrwxrwx 1 root root 10 Jul 29 10:26 294c8a0c-86e1-441f-8e5a-df5a4fc4585a -&gt; ../..</code><code>/sdb1</code>

<code>2)更新原來的uuid</code>

<code># mount –o remount,rw /</code>

<code># vim /etc/fstab</code>

<code>将:</code>

<code>UUID=8fc1e2f4-a6b4-4c5c-99d9-c6ae545a6d63 </code><code>/data</code>                   <code>ext4    defaults        1 2</code>

<code>修改為:</code>

<code>UUID=294c8a0c-86e1-441f-8e5a-df5a4fc4585a </code><code>/data</code>                   <code>ext4    defaults        1 2</code>

<code>或者可以這樣:</code>

<code>echo</code> <code>"UUID=$(blkid /dev/sdb1 |cut -d'"</code><code>' -f2) </code><code>/data</code>                 <code>ext4    defaults        1 2" &gt;&gt;</code><code>/etc/fstab</code>

<code>重新開機系統:</code>

<code>reboot</code>

<code>fstab中的内容解釋請參考</code><code>man</code><code>中的内容。</code>

<code>The first field, (fs_spec), describes the block special device or remote filesystem</code>

<code>       </code><code>to be mounted.</code>

<code>       </code><code>指定被挂載的裝置</code>

<code>The second field, (fs_file), describes the </code><code>mount</code> <code>point  </code><code>for</code>  <code>the  filesystem.   For</code>

<code>       </code><code>swap partitions, this field should be specified as ‘none’. If the name of the </code><code>mount</code>

<code>       </code><code>point contains spaces these can be escaped as ‘\040’.</code>

<code>       </code><code>指定挂載點</code>

<code>The third field, (fs_vfstype), describes the </code><code>type</code> <code>of the  filesystem. </code>

<code>       </code><code>指定fs格式</code>

<code>The fourth  field,  (fs_mntops),  describes  the </code><code>mount</code> <code>options associated with the</code>

<code>       </code><code>filesystem.     </code>

<code>       </code><code>指定挂載選項</code>

<code>The fifth field, (fs_freq), is used </code><code>for</code> <code>these filesystems by the dump(8) </code><code>command</code> <code>to</code>

<code>       </code><code>determine  </code><code>which</code> <code>filesystems need to be dumped.  If the fifth field is not present,</code>

<code>       </code><code>a value of zero is returned and dump will assume that the filesystem does not  need</code>

<code>       </code><code>to be dumped.</code>

<code>       </code><code>供dump用</code>

<code>The sixth field, (fs_passno), is used by the </code><code>fsck</code><code>(8) program to determine the order</code>

<code>       </code><code>in</code> <code>which</code> <code>filesystem checks are </code><code>done</code> <code>at reboot </code><code>time</code><code>.  The root filesystem should  be</code>

<code>       </code><code>specified  with  a fs_passno of 1, and other filesystems should have a fs_passno of</code>

<code>       </code><code>2.  Filesystems within a drive will be checked  sequentially,  but  filesystems  on</code>

<code>       </code><code>different  drives will be checked at the same </code><code>time</code> <code>to utilize parallelism available</code>

<code>       </code><code>in</code> <code>the hardware.  If the sixth field is not present or zero, a  value  of  zero  is</code>

<code>       </code><code>returned and </code><code>fsck</code> <code>will assume that the filesystem does not need to be checked.</code>

<code>       </code><code>供</code><code>fsck</code><code>用,root是1,其他的fs是2</code>

本文轉自 pcnk 51CTO部落格,原文連結:http://blog.51cto.com/nosmoking/1611824,如需轉載請自行聯系原作者

繼續閱讀