亚洲韩日午夜视频,欧美日韩在线精品一区二区三区,韩国超清无码一区二区三区,亚洲国产成人影院播放,久草新在线,在线看片AV色

您好,歡迎來到思海網絡,我們將竭誠為您提供優質的服務! 誠征網絡推廣 | 網站備案 | 幫助中心 | 軟件下載 | 購買流程 | 付款方式 | 聯系我們 [ 會員登錄/注冊 ]
促銷推廣
客服中心
業務咨詢
有事點擊這里…  531199185
有事點擊這里…  61352289
點擊這里給我發消息  81721488
有事點擊這里…  376585780
有事點擊這里…  872642803
有事點擊這里…  459248018
有事點擊這里…  61352288
有事點擊這里…  380791050
技術支持
有事點擊這里…  714236853
有事點擊這里…  719304487
有事點擊這里…  1208894568
有事點擊這里…  61352289
在線客服
有事點擊這里…  531199185
有事點擊這里…  61352288
有事點擊這里…  983054746
有事點擊這里…  893984210
當前位置:首頁 >> 技術文章 >> 文章瀏覽
技術文章

Linux中獲取全球唯一標示符UUID的方法

添加時間:2016-3-24 2:13:52  添加: 思海網絡 
UUID(Universally Unique IDentifiers),全球唯一標示符.它是一個標識系統中的存儲設備的字符串,使其確定系統中的所有存儲設備。

為什么要使用UUID?因為系統自動分配的設備名稱并非總是一致的,它們依賴于啟動時內核加載模塊的順序.相同的名稱可能代表不同的硬盤分區.如果每個分區有一個唯一的UUID值,尤其是在grub中的kernel設置,這樣就不會發生分區識別混亂的問題.

下面介紹幾種方法來獲得UUID.

1.最簡單的方法就是使用blkid命令,它主要用來對系統的塊設備(包括交換分區)所使用的文件系統類型,LABEL,UUID等信息查詢. 使用這個命令需要安裝e2fsprogs包.


代碼如下:
root@10.1.1.200:~# dpkg -l | grep e2fsprogs
ii e2fsprogs 1.41.3-1 ext2/ext3/ext4 file system utilities
ii libuuid-perl 0.02-4 Perl extension for using UUID interfaces as defined in e2fsprogs
root@10.1.1.200:~# blkid 
/dev/sda1: UUID="b20e80f1-c88d-4918-9d9b-75cd7906629e" TYPE="ext3"
/dev/sda5: TYPE="swap" UUID="1fb3d17b-b2fe-470d-b39c-f00c4a30efbf"
/dev/sda6: UUID="c7050200-7efb-468c-81d1-a3add309bee1" TYPE="ext3" SEC_TYPE="ext2"
/dev/sda7: UUID="934e4e22-3431-4707-8d47-dca47e76f448" TYPE="xfs"
/dev/hioa: UUID="de0af117-ad92-4867-aa21-3e7d423e8864" TYPE="xfs"
root@10.1.1.200:~# blkid /dev/sda1
/dev/sda1: UUID="b20e80f1-c88d-4918-9d9b-75cd7906629e" TYPE="ext3"
root@10.1.1.200:~# cat /etc/blkid.tab
<device DEVNO="0x0801" TIME="1364787338" UUID="b20e80f1-c88d-4918-9d9b-75cd7906629e" TYPE="ext3">/dev/sda1</device>
<device DEVNO="0x0805" TIME="1364787338" TYPE="swap" UUID="1fb3d17b-b2fe-470d-b39c-f00c4a30efbf">/dev/sda5</device>
<device DEVNO="0x0806" TIME="1364787338" UUID="c7050200-7efb-468c-81d1-a3add309bee1" TYPE="ext3" SEC_TYPE="ext2">/dev/sda6</device>
<device DEVNO="0x0807" TIME="1364787338" UUID="934e4e22-3431-4707-8d47-dca47e76f448" TYPE="xfs">/dev/sda7</device>
<device DEVNO="0xfd00" TIME="1364787338" UUID="de0af117-ad92-4867-aa21-3e7d423e8864" TYPE="xfs">/dev/hioa</device>

2.通過瀏覽/dev/disk/by-uuid/下的設備文件信息.


代碼如下:
root@10.1.1.200:~# ls -l /dev/disk/by-uuid/
total 0
lrwxrwxrwx 1 root root 10 2013-03-19 11:01 1fb3d17b-b2fe-470d-b39c-f00c4a30efbf -> ../../sda5
lrwxrwxrwx 1 root root 10 2013-03-19 11:01 934e4e22-3431-4707-8d47-dca47e76f448 -> ../../sda7
lrwxrwxrwx 1 root root 10 2013-03-19 11:01 b20e80f1-c88d-4918-9d9b-75cd7906629e -> ../../sda1
lrwxrwxrwx 1 root root 10 2013-03-19 11:01 c7050200-7efb-468c-81d1-a3add309bee1 -> ../../sda6
lrwxrwxrwx 1 root root 10 2013-03-19 11:02 de0af117-ad92-4867-aa21-3e7d423e8864 -> ../../hioa
root@10.1.1.200:~# ls -l /dev/disk/by-uuid/ | grep sda1 | awk '{print $8}'
b20e80f1-c88d-4918-9d9b-75cd7906629e

3.通過vol_id命令查看


代碼如下:
root@10.1.1.200:~# vol_id /dev/sda1
ID_FS_USAGE=filesystem
ID_FS_TYPE=ext3
ID_FS_VERSION=1.0
ID_FS_UUID=b20e80f1-c88d-4918-9d9b-75cd7906629e
ID_FS_UUID_ENC=b20e80f1-c88d-4918-9d9b-75cd7906629e
ID_FS_LABEL=
ID_FS_LABEL_ENC=
ID_FS_LABEL_SAFE=
root@10.1.1.200:~# vol_id /dev/sda1 | grep 'UUID'
ID_FS_UUID=b20e80f1-c88d-4918-9d9b-75cd7906629e
ID_FS_UUID_ENC=b20e80f1-c88d-4918-9d9b-75cd7906629e、

4.使用tune2fs,,它是linux下文件系統調整工具


代碼如下:
root@10.1.1.200:~# tune2fs -l /dev/sda1
tune2fs 1.41.3 (12-Oct-2008)
Filesystem volume name: <none>
Last mounted on: <not available>
Filesystem UUID: b20e80f1-c88d-4918-9d9b-75cd7906629e
Filesystem magic number: 0xEF53
Filesystem revision #: 1 (dynamic)
Filesystem features: has_journal ext_attr resize_inode dir_index filetype needs_recovery sparse_super large_file
Filesystem flags: signed_directory_hash 
Default mount options: (none)
Filesystem state: clean
Errors behavior: Continue
Filesystem OS type: Linux
Inode count: 1864128
Block count: 7442103
Reserved block count: 372105
Free blocks: 6884819
Free inodes: 1712582
First block: 0
root@10.1.1.200:~# tune2fs -l /dev/sda1 | grep 'UUID'
Filesystem UUID: b20e80f1-c88d-4918-9d9b-75cd7906629e

這里額外在看下tune2fs一些常用參數:


代碼如下:
root@192.168.2.80:~# tune2fs --help
tune2fs 1.41.3 (12-Oct-2008)
tune2fs: invalid option -- '-'
Usage: tune2fs [-e errors_behavior] [-g group]

[-i interval[d|m|w]] 文件系統的檢查間隔時間,系統在達到時間間隔,自動檢查文件系統.
[-j] [-J journal_options] 轉換文件系統
[-l] 顯示文件系統參數
[-m reserved_blocks_percent] 設置保留的空間百分比
[-o [^]mount_options[,...]] 設置默認加載參數.
[-c max_mounts_count] 表示文件系統在mount次數達到設定后,需要運行fsck檢查文件系統。
  
通常如果使用ext3文件系統的話,使用-c 0關掉mount次數達到后的文件系統檢查。
禁止強制的文件系統檢查:


代碼如下:
root@10.1.1.200:~# tune2fs -i0 -c0 /dev/sda1
tune2fs 1.41.3 (12-Oct-2008)
Setting maximal mount count to -1
Setting interval between checks to 0 seconds

還有一個dump2fs也是文件系統調整的工具.

dump2fs顯示當前的磁盤狀態:

代碼如下:
root@10.1.1.200:~# dumpe2fs /dev/sda1
Filesystem volume name: <none>
Last mounted on: <not available>
Filesystem UUID: b20e80f1-c88d-4918-9d9b-75cd7906629e
Filesystem magic number: 0xEF53
Filesystem revision #: 1 (dynamic)
Filesystem features: has_journal ext_attr resize_inode dir_index filetype needs_recovery sparse_super large_file
Filesystem flags: signed_directory_hash 
Default mount options: (none)
Filesystem state: clean
Errors behavior: Continue
Filesystem OS type: Linux
Inode count: 1864128
Block count: 7442103
Reserved block count: 372105
Free blocks: 6884819
Free inodes: 1712582
First block: 0
Block size: 4096
Fragment size: 4096
Reserved GDT blocks: 1022
Blocks per group: 32768
Fragments per group: 32768
Inodes per group: 8176
Inode blocks per group: 511
Filesystem created: Fri Nov 16 15:36:59 2012
Last mount time: Tue Mar 19 11:02:58 2013
Last write time: Wed Mar 27 14:09:25 2013
Mount count: 17
Maximum mount count: -1
Last checked: Fri Nov 16 15:36:59 2012
Check interval: 0 (<none>)
Reserved blocks uid: 0 (user root)
Reserved blocks gid: 0 (group root)
First inode: 11
Inode size: 256
Required extra isize: 28
Desired extra isize: 28
Journal inode: 8
First orphan inode: 1618875
Default directory hash: half_md4
Directory Hash Seed: 3090ccf1-625c-4934-9ec4-be3f74767f98
Journal backup: inode blocks
Journal size: 128M

 

代碼如下:
Group 0: (Blocks 0-32767)
Primary superblock at 0, Group deors at 1-2
Reserved GDT blocks at 3-1024
Block bitmap at 1025 (+1025), Inode bitmap at 1026 (+1026)
Inode table at 1027-1537 (+1027)
0 free blocks, 8152 free inodes, 2 directories
Free blocks: 
Free inodes: 22, 25, 27-8176
Group 1: (Blocks 32768-65535)
Backup superblock at 32768, Group deors at 32769-32770
Reserved GDT blocks at 32771-33792
Block bitmap at 33793 (+1025), Inode bitmap at 33794 (+1026)
Inode table at 33795-34305 (+1027)
3 free blocks, 8176 free inodes, 0 directories
Free blocks: 34309-34311
Free inodes: 8177-16352
Group 2: (Blocks 65536-98303)
Block bitmap at 65536 (+0), Inode bitmap at 65537 (+1)
Inode table at 65538-66048 (+2)
7 free blocks, 8176 free inodes, 0 directories
Free blocks: 66049-66055
Free inodes: 16353-24528
Group 3: (Blocks 98304-131071)
Backup superblock at 98304, Group deors at 98305-98306
Reserved GDT blocks at 98307-99328
Block bitmap at 99329 (+1025), Inode bitmap at 99330 (+1026)
Inode table at 99331-99841 (+1027)
6 free blocks, 8176 free inodes, 0 directories
Free blocks: 99842-99847
Free inodes: 24529-32704
Group 4: (Blocks 131072-163839)
Block bitmap at 131072 (+0), Inode bitmap at 131073 (+1)
Inode table at 131074-131584 (+2)
63 free blocks, 0 free inodes, 0 directories
Free blocks: 132074-132079, 133643-133647, 135671, 137739-137743, 139811-139815, 141814-141815, 143879, 145922-145927, 147933-147935, 150022-150023, 15207
1, 154107-154111, 156169-156175, 158202-158207, 160251-160255, 162293-162295
Free inodes: 
Group 5: (Blocks 163840-196607)
Backup superblock at 163840, Group deors at 163841-163842
Reserved GDT blocks at 163843-164864
Block bitmap at 164865 (+1025), Inode bitmap at 164866 (+1026)
Inode table at 164867-165377 (+1027)
0 free blocks, 8130 free inodes, 0 directories
Free blocks: 
Free inodes: 40881, 40928-49056


關鍵字:Linux、系統、UUID
分享到:

頂部 】 【 關閉
版權所有:佛山思海電腦網絡有限公司 ©1998-2024 All Rights Reserved.
聯系電話:(0757)22630313、22633833
中華人民共和國增值電信業務經營許可證: 粵B1.B2-20030321 備案號:粵B2-20030321-1
網站公安備案編號:44060602000007 交互式欄目專項備案編號:200303DD003  
察察 工商 網安 舉報有獎  警警  手機打開網站