Obtain the uuid of the RHEL6 disk partition and the role of UUID

Source: Internet
Author: User
I. How to obtain UUID in Linux disk partition 1. # fdisk-lDisk/dev/sda: 1000.2 GB, 1000204886016bytes240heads, 63 sectors/track, 129201 cylindersUnits = cylindersof15120 * 512 = 7741440 bytesSectorsize (logical/physic

I. How to obtain the UUID of a Linux disk partition

1. # fdisk-l

Disk/dev/sda: 1000.2 GB, 1000204886016 bytes
240 heads, 63 sectors/track, 129201 cylinders
Units = cylinders of 15120*512 = 7741440 bytes
Sector size (logical/physical): 512 bytes/512 bytes
I/O size (minimum/optimal): 512 bytes/512 bytes
Disk identifier: 0x54f054f0

Device Boot Start End Blocks Id System
/Dev/sda1*1 6772 51196288 + 7 HPFS/NTFS
/Dev/sda2 6773 129200 925555680 f W95 Ext 'd (LBA)
/Dev/sda5 6773 33862 204800368 + 7 HPFS/NTFS
/Dev/sda6 33863 47408 102400000 7 HPFS/NTFS
/Dev/sda7 47408 61476 106354688 7 HPFS/NTFS
/Dev/sda8 61476 61503 204800 83 Linux
/Dev/sda9 61503 75048 102400000 83 Linux
/Dev/sda10 75048 88593 102400000 83 Linux
/Dev/sda11 88593 91302 20480000 83 Linux
/Dev/sda12 91302 92657 10240000 82 Linux swap/Solaris

2. # df-h
Filesystem Size Used Avail Use % Mounted on
/Dev/sda11 20G 1.6G 17G 9%/
Tmpfs 3.9G 260 K 3.9G 1%/dev/shm
/Dev/sda8 194 M 30 M 155 M 16%/boot
/Dev/sda10 97G 188 M 92G 1%/opt
/Dev/sda9 97G 298 M 91G 1%/var

3. # cat/etc/fstab

#
#/Etc/fstab
# Created by anaconda on Wed Nov 23 10:11:32 2011
#
# Accessible filesystems, by reference, are maintained under '/dev/disk'
# See man pages fstab (5), findfs (8), mount (8) and/or blkid (8) for more info
#
UUID = 15d68d9f-e1a9-45dd-8823-37b7ecafce47/ext4 ults 1 1
UUID = 575c18d8-4776-4ecf-abd6-1209293d0737/boot ext4 ults 1 2
UUID = 98b4689f-d70e-4903-a8b4-8054e5a968ee/opt ext4 defaults 1 2
UUID = a9558fcf-9e8b-448f-8003-212716694bce/var ext4 defaults 1 2
UUID = 49446740-94ac-46fa-a80d-f072932e9a8a swap defaults 0 0
Tmpfs/dev/shm tmpfs defaults 0 0
Devpts/dev/pts devpts gid = 5, mode = 620 0 0
Sysfs/sys sysfs defaults 0 0
Proc/proc defaults 0 0

4. I want to format/dev/sda10 here.

# Umount/opt

# Mkfs. ext4/dev/sda10

# Mount-a: An error is reported. uuid does not match.

# Blkid/dev/sda10 get the current UUID

# Vi/etc/fstab modify the uuid in the/opt Column

# Mount-a solution

Ii. Functions and significance of Linux UUID

1. It is the only identifier.

UUID provides a unique identifier string for the storage device in the system, regardless of the type of the device. If you add a new storage device, such as a hard disk, to the system, it may cause some trouble. For example, the device fails to be found during startup, however, using UUID will not cause such problems.

2. The device name is not always the same

The automatically assigned device names are not always the same. They depend on the kernel loading module sequence at startup. If you start the system when you insert a USB disk and unplug it the next time, the device name distribution may be inconsistent.

3. Many key features in rhel6 are now dependent on UUID

For example, grub:

# Cat/boot/grub. conf
# Grub. conf generated by anaconda
#
# Note that you do not have to rerun grub after making changes to this file
# NOTICE: You have a/boot partition. This means that
# All kernel and initrd paths are relative to/boot/, eg.
# Root (hd0, 0)
# Kernel/vmlinuz-version ro root =/dev/sdb3
# Initrd/initrd-[generic-] version. img
# Boot =/dev/sdb
Default = 0
Timeout = 1
Splashimage = (hd0, 0)/grub/splash.xpm.gz
Hiddenmenu
Title ECData (2.6.32-71. el6.x86 _ 64)
Root (hd0, 0)
Kernel/vmlinuz-2.6.32-71.el6.x86_64 ro root =UUID = 72e9d119-3bdc-4f06-b84c-0e70a92483c9Rd_NO_LUKS rd_NO_LVM rd_NO_MD rd_NO_DM LANG = en_US.UTF-8 SYSFONT = latarcyrheb-sun16 KEYBOARDTYPE = pc KEYTABLE = us crashkernel = auto rhgb quiet vga = 0x317
Initrd/initramfs-2.6.32-71.el6.x86_64.img

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

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.