Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1490218
  • 博文数量: 230
  • 博客积分: 474
  • 博客等级: 下士
  • 技术积分: 1955
  • 用 户 组: 普通用户
  • 注册时间: 2010-03-19 18:40
文章分类

全部博文(230)

文章存档

2020年(3)

2019年(3)

2018年(12)

2017年(13)

2016年(11)

2015年(55)

2014年(74)

2013年(39)

2012年(2)

2011年(18)

我的朋友

分类: LINUX

2014-08-05 10:15:07

linux中的分区都使用uuid表示。 uuid是通过算法生成的一个格式如”2c07220f-8daa-463a-a4b1-ca4ae4941eff“的串。这个信息是存在分区中的。

常见有一下两种方式查看:


1、通过设备目录


[plain] view plaincopy
  1. niu@niu:~/foss/linux/Documentation$ ls -l /dev/disk/by-uuid/  
  2. total 0  
  3.   
  4. lrwxrwxrwx 1 root root 10 Feb  9 12:54 2c07220f-8daa-463a-a4b1-ca4ae4941eff -> ../../sda5  
  5. lrwxrwxrwx 1 root root 10 Feb  9 12:54 761e2b46-6f1d-46b4-aaa1-1d82aae82b3b -> ../../sda1  
  6. lrwxrwxrwx 1 root root 10 Feb  9 12:54 847C79467C7933D0 -> ../../sda3  
  7. lrwxrwxrwx 1 root root 10 Feb  9 12:54 8c0b4537-4251-409d-a0f2-d03cbcb688ec -> ../../sda6  
  8. lrwxrwxrwx 1 root root 10 Feb  9 12:54 b525a784-e1ee-48ff-b803-3d4e51709467 -> ../../sda7  




2、通过blkid命令读取分区信息


[plain] view plaincopy
  1. niu@niu:~/foss/linux/Documentation$ sudo blkid  
[plain] view plaincopy
  1. /dev/sda1: UUID="761e2b46-6f1d-46b4-aaa1-1d82aae82b3b" TYPE="ext2"   
  2. /dev/sda3: UUID="847C79467C7933D0" TYPE="ntfs"   
  3. /dev/sda5: UUID="2c07220f-8daa-463a-a4b1-ca4ae4941eff" TYPE="reiserfs"   
  4. /dev/sda6: UUID="8c0b4537-4251-409d-a0f2-d03cbcb688ec" TYPE="ext4"   
  5. /dev/sda7: UUID="b525a784-e1ee-48ff-b803-3d4e51709467" TYPE="swap"   
  6. /dev//sda1: UUID="761e2b46-6f1d-46b4-aaa1-1d82aae82b3b" TYPE="ext2"   


写入的话需要使用tune2fs命令,通常情况下需要生成一个新的uuid,也就是使用uuidgen命令

【注意:这个命令不要轻易试,如果忘记修改对应的grub.cfg和fstab等文件,系统会不正常】


[plain] view plaincopy
  1. niu@niu:~/foss/linux/Documentation$ uuidgen  
  2. 2125190c-0317-4460-8cad-4f5b9fa46633  
  3.   
  4. niu@niu:~/foss/linux/Documentation$ sudo tune2fs /dev/sda1 -U 2125190c-0317-4460-8cad-4f5b9fa46633  
阅读(2001) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~