Linux磁碟分割UUID的擷取及其UUID的作用

來源:互聯網
上載者:User

註:UUID-Universally Unique IDentifiers通用唯一識別碼

一、Linux磁碟分割UUID的擷取方法

1、[san@localhost ~]$ ls -l /dev/disk/by-uuid/
total 0
lrwxrwxrwx 1 root root 10 2010-01-18 02:18 0733f5c1-cb85-4f98-9d4f-122cfcee9806 -> http://www.cnblogs.com/sdc1

lrwxrwxrwx 1 root root 10 2010-01-18 01:13 3754-1BDB -> http://www.cnblogs.com/sda5
lrwxrwxrwx 1 root root 10 2010-01-18 01:13 41a18221-6b1f-4ca2-9bc3-dc353c87d932 -> http://www.cnblogs.com/sda9
lrwxrwxrwx 1 root root 10 2010-01-18 01:13 57183ff9-d4a5-4623-a47f-f8f17339be03 -> http://www.cnblogs.com/sda7
lrwxrwxrwx 1 root root 10 2010-01-18 01:13 6bdf487f-cad7-4197-b0d9-4ddc6df1de2d -> http://www.cnblogs.com/sda8
lrwxrwxrwx 1 root root 10 2010-01-18 01:13 ae6dcc02-3f7f-47cc-8a6e-e29218b4d345 -> http://www.cnblogs.com/sda6
lrwxrwxrwx 1 root root 10 2010-01-18 01:13 CC47-2A04 -> http://www.cnblogs.com/sda1

lrwxrwxrwx 1 root root 10 2010-01-18 02:18 d2154d3e-3006-4a05-a134-f721145f1670 -> http://www.cnblogs.com/sdc2
lrwxrwxrwx 1 root root 10 2010-01-18 02:18 df974270-dbba-4f87-8121-427636dab396 -> http://www.cnblogs.com/sdc3

lrwxrwxrwx 1 root root 10 2010-01-18 01:52 f535fef8-f392-4c84-8e7a-85915d9179fb -> http://www.cnblogs.com/sdb1


VS:

lrwxrwxrwx 1 root root 10 2010-01-18 02:25 0733f5c1-cb85-4f98-9d4f-122cfcee9806 -> http://www.cnblogs.com/sdb1
lrwxrwxrwx 1 root root 10 2010-01-18 01:13 3754-1BDB -> http://www.cnblogs.com/sda5
lrwxrwxrwx 1 root root 10 2010-01-18 01:13 41a18221-6b1f-4ca2-9bc3-dc353c87d932 -> http://www.cnblogs.com/sda9
lrwxrwxrwx 1 root root 10 2010-01-18 01:13 57183ff9-d4a5-4623-a47f-f8f17339be03 -> http://www.cnblogs.com/sda7
lrwxrwxrwx 1 root root 10 2010-01-18 01:13 6bdf487f-cad7-4197-b0d9-4ddc6df1de2d -> http://www.cnblogs.com/sda8
lrwxrwxrwx 1 root root 10 2010-01-18 01:13 ae6dcc02-3f7f-47cc-8a6e-e29218b4d345 -> http://www.cnblogs.com/sda6
lrwxrwxrwx 1 root root 10 2010-01-18 01:13 CC47-2A04 -> http://www.cnblogs.com/sda1
lrwxrwxrwx 1 root root 10 2010-01-18 02:25 d2154d3e-3006-4a05-a134-f721145f1670 -> http://www.cnblogs.com/sdb2
lrwxrwxrwx 1 root root 10 2010-01-18 02:25 df974270-dbba-4f87-8121-427636dab396 -> http://www.cnblogs.com/sdb3


2、通過blkid命令


[san@localhost ~]$ blkid /dev/sdb1
/dev/sdb1: LABEL="SAN " UUID="f535fef8-f392-4c84-8e7a-85915d9179fb " TYPE="ext3 "

[san@localhost ~]$ blkid /dev/sda6

/dev/sda6: LABEL="/" UUID="ae6dcc02-3f7f-47cc-8a6e-e29218b4d345 " TYPE="ext3" SEC_TYPE="ext2 "

二、Linux UUID的作用及意義

 原因1:它是真正的唯一標誌符

UUID為系統中的存放裝置提供唯一的標識字串,不管這個裝置是什麼類型的。如果你在系統中添加了新的存放裝置如硬碟,很可能會造成一些麻煩,比如說啟動的時候因為找不到裝置而失敗,而使用UUID則不會有這樣的問題。

原因2:裝置名稱並非總是不變的

自動分配的裝置名稱並非總是一致的,它們依賴於啟動時核心載入模組的順序。如果你在插入了USB盤時啟動了系統,而下次啟動時又把它拔掉了,就有可能導致裝置名稱分配不一致。

使用UUID對於掛載行動裝置也非常有好處──例如我有一個24合一的讀卡機,它支援各種各樣的卡,而使用UUID總可以使同一塊卡掛載在同一個地方。

原因3:ubuntu中的許多關鍵功能現在開始依賴於UUID

例如grub──系統引導程式,現在可以識別UUID,開啟你的/boot/grub/menu.lst,你可以看到類似如下的語句:
title Ubuntu hardy (development branch), kernel 2.6.24-16-generic
root (hd2,0)
kernel /boot/vmlinuz-2.6.24-16-generic root=UUID=c73a37c8-ef7f-40e4-b9de-8b2f81038441 ro quiet splash
initrd /boot/initrd.img-2.6.24-16-generic
quiet

本段出處:DIY部落(http://www.diybl.com/course/6_system/linux/Linuxjs/2008930/147029.html)

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.