Linux How-To

The best way to add UUID entry in /and many others/fstab in Linux

SEOClerks

On this brief tutorial we are going to stroll you thru how you can get UUID of the filesystem in order that it may be utilized in /and many others/fstab.

UUID entry in /and many others/fstab

To begin with take into account it is advisable format your logical quantity to get UUID registered in kernel for it. Logical quantity with out filesystem on it wont be having UUID hooked up to it. In case you are sing partitioning quantity supervisor then disk partitions may have PARTUUID (partition UUID) even should you dont format them. However its not helpful in /and many others/fstab since fstab offers with formatted partitions.

The best way to discover UUID for logical quantity

For this tutorial contemplate beneath setup –

[root@kerneltalks ~]# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
xvda 202:zero zero 8G zero disk
└─xvda1 202:1 zero 8G zero half /
xvdf 202:80 zero 1G zero disk
└─datavg-lvol0 253:zero zero 1020M zero lvm

 

[root@kerneltalks ~]# lsblk

NAME           MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT

xvda           202:zero    zero    8G  zero disk

└─xvda1        202:1    zero    8G  zero half /

xvdf           202:80   zero    1G  zero disk

└─datavglvol0 253:zero    zero 1020M  zero lvm

 

We’ve one logical quantity named lvol0 in quantity group datavg and now we have to discover UUID for it. Use command blkid and grep in your logical quantity title to get your required output –

[root@kerneltalks ~]# blkid |grep lvol0
/dev/mapper/datavg-lvol0: UUID=”5caaee32-c3d3-429e-bad7-2898cf923805″ TYPE=”ext4″

 

[root@kerneltalks ~]# blkid |grep lvol0

/dev/mapper/datavglvol0: UUID=“5caaee32-c3d3-429e-bad7-2898cf923805” TYPE=“ext4”

 

You may see you’ve gotten UUID for the lvol you talked about and together with it additionally sourced its filesystem sort which is ext4.

The best way to add UUID entry in /and many others/fstab

Lets add this UUID entry in /and many others/fstab utilizing format –

So our entry will appear to be –

UUID=5caaee32-c3d3-429e-bad7-2898cf923805 /knowledge ext4 defaults zero zero

 

UUID=5caaee32c3d3429ebad72898cf923805  /knowledge  ext4  defaults zero zero

 

We’re mounting it on /knowledge listing with default mount choices and no fschecks. Add this entry to fstab and run mount -a and mount level established!

[root@kerneltalks ~]# df -Ph /data1
Filesystem Measurement Used Avail Use% Mounted on
/dev/mapper/datavg-lvol0 988M 2.6M 919M 1% /knowledge

 

[root@kerneltalks ~]# df -Ph /data1

Filesystem                Measurement  Used Avail Use% Mounted on

/dev/mapper/datavglvol0  988M  2.6M  919M   1% /knowledge

 

The best way to discover UUID for disk partition

Contemplate beneath setup for locating UUID for disk partition.

[root@kerneltalks ~]# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
xvda 202:zero zero 8G zero disk
└─xvda1 202:1 zero 8G zero half /
xvdf 202:80 zero 1G zero disk
└─xvdf1 202:81 zero 1023M zero half

 

[root@kerneltalks ~]# lsblk

NAME    MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT

xvda    202:zero    zero    8G  zero disk

└─xvda1 202:1    zero    8G  zero half /

xvdf    202:80   zero    1G  zero disk

└─xvdf1 202:81   zero 1023M  zero half

 

Right here we’ve one non-root disk /dev/xvdf with one full partition /dev/xvdf1 on it. And its not but formatted with any filesystem. Now should you run blkid command one can find PARTUUID for this partition.

[root@kerneltalks ~]# blkid |grep xvdf1
/dev/xvdf1: PARTUUID=”6d123669-01″

 

[root@kerneltalks ~]# blkid |grep xvdf1

/dev/xvdf1: PARTUUID=“6d123669-01”

 

I format it in order that I can mount it on listing. And after formtting it with ext4 filesystem right here is UUID making an entry!

[root@kerneltalks ~]# blkid | grep xvdf1
/dev/xvdf1: UUID=”05ba450d-9c60-43f1-9dd1-8b6f89857961″ TYPE=”ext4″ PARTUUID=”6d123669-01″

 

[root@kerneltalks ~]# blkid | grep xvdf1

/dev/xvdf1: UUID=“05ba450d-9c60-43f1-9dd1-8b6f89857961” TYPE=“ext4” PARTUUID=“6d123669-01”

 

You may evaluate this output with earlier one and you may see after formatting with ext4 you get UUID which can be utilized in /and many others/fstab as defined earlier on this submit.

Source link

Related Articles

Leave a Reply

Back to top button