how to identify UUID conf or ordinary dev conf from fstab

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
1
down vote

favorite












we need to add disks on more then 100 redhat machines,



therefore we need to update also the /etc/fstab on each machine



the problem is that some machines configured with UUID and other with ordinary dev in fstab



so I want to make a bash script that will identify the fstab configuration as the following



  1. in case fstab configured with UUID add new UUID lines for each additional disk

  2. in case fstab configured with ordinary dev then add new dev lines for each additional disk

so my question is - what is the best approach to identify what configured in fstab UUID or ordinary dev ?



remark - not include the OS , we talk here only on additional disks in HW machines



here is example of linux machine with UUID conf in fstab



/dev/mapper/vg00-loov_root / xfs defaults 00 
UUID=7de1dc5c-b605-4a6f-bdf1-f1e869f6ffb9 /boot xfs
defaults 0 0
/dev/mapper/vg00-loov_var /var xfs defaults 00
/dev/mapper/vg00-loov_swap swap swap defaults 00
UUID="fcb73644-4ad3-4b19-85f8-dbb9ed53a871" /data/sdb
ext4 defaults,noatime 0 0
UUID="5f56c1d6-266f-4ea2-a8f7-df06f08e01c0" /data/sdc
ext4 defaults,noatime 0 0
UUID="4c908671-4045-41e8-a396-a5198978e3ac" /data/sdd
ext4 defaults,noatime 0 0
UUID="d44fe62a-72dc-4674-91ac-5a1962797e22" /data/sde
ext4 defaults,noatime 0 0
UUID="ee3d8fa8-e000-4abb-a26c-da99499e630c" /data/sdf
ext4 defaults,noatime 0 0
UUID="61e9e16f-eb49-4c97-aaf0-0ed2dc3f3007" /data/sdg
ext4 defaults,noatime 0 0
UUID="ada12394-0e0b-4657-a148-d85548d7bc75" /data/sdh
ext4 defaults,noatime 0 0






share|improve this question






















  • Why is it a problem that some systems do not use UUIDs yet? Is that anyhow an argument against UUIDs for the new disks?
    – Hauke Laging
    Jan 4 at 0:22






  • 3




    If you already have 100 machines that have inconsistent configuration styles then you have a bigger problem to solve first. You need to look into using something like puppet or ansible
    – cas
    Jan 4 at 1:58











  • what we want is to do the same conf on fstab I mean that if machine have UUID then need to insert UUID lines if machine have ordinary dev lines then need to insert DEV ordinary lines to fstan , all this to avoid mishmash on fstab file , it will not be good if fstab file will include both configuration isnt it?
    – yael
    Jan 4 at 5:47














up vote
1
down vote

favorite












we need to add disks on more then 100 redhat machines,



therefore we need to update also the /etc/fstab on each machine



the problem is that some machines configured with UUID and other with ordinary dev in fstab



so I want to make a bash script that will identify the fstab configuration as the following



  1. in case fstab configured with UUID add new UUID lines for each additional disk

  2. in case fstab configured with ordinary dev then add new dev lines for each additional disk

so my question is - what is the best approach to identify what configured in fstab UUID or ordinary dev ?



remark - not include the OS , we talk here only on additional disks in HW machines



here is example of linux machine with UUID conf in fstab



/dev/mapper/vg00-loov_root / xfs defaults 00 
UUID=7de1dc5c-b605-4a6f-bdf1-f1e869f6ffb9 /boot xfs
defaults 0 0
/dev/mapper/vg00-loov_var /var xfs defaults 00
/dev/mapper/vg00-loov_swap swap swap defaults 00
UUID="fcb73644-4ad3-4b19-85f8-dbb9ed53a871" /data/sdb
ext4 defaults,noatime 0 0
UUID="5f56c1d6-266f-4ea2-a8f7-df06f08e01c0" /data/sdc
ext4 defaults,noatime 0 0
UUID="4c908671-4045-41e8-a396-a5198978e3ac" /data/sdd
ext4 defaults,noatime 0 0
UUID="d44fe62a-72dc-4674-91ac-5a1962797e22" /data/sde
ext4 defaults,noatime 0 0
UUID="ee3d8fa8-e000-4abb-a26c-da99499e630c" /data/sdf
ext4 defaults,noatime 0 0
UUID="61e9e16f-eb49-4c97-aaf0-0ed2dc3f3007" /data/sdg
ext4 defaults,noatime 0 0
UUID="ada12394-0e0b-4657-a148-d85548d7bc75" /data/sdh
ext4 defaults,noatime 0 0






share|improve this question






















  • Why is it a problem that some systems do not use UUIDs yet? Is that anyhow an argument against UUIDs for the new disks?
    – Hauke Laging
    Jan 4 at 0:22






  • 3




    If you already have 100 machines that have inconsistent configuration styles then you have a bigger problem to solve first. You need to look into using something like puppet or ansible
    – cas
    Jan 4 at 1:58











  • what we want is to do the same conf on fstab I mean that if machine have UUID then need to insert UUID lines if machine have ordinary dev lines then need to insert DEV ordinary lines to fstan , all this to avoid mishmash on fstab file , it will not be good if fstab file will include both configuration isnt it?
    – yael
    Jan 4 at 5:47












up vote
1
down vote

favorite









up vote
1
down vote

favorite











we need to add disks on more then 100 redhat machines,



therefore we need to update also the /etc/fstab on each machine



the problem is that some machines configured with UUID and other with ordinary dev in fstab



so I want to make a bash script that will identify the fstab configuration as the following



  1. in case fstab configured with UUID add new UUID lines for each additional disk

  2. in case fstab configured with ordinary dev then add new dev lines for each additional disk

so my question is - what is the best approach to identify what configured in fstab UUID or ordinary dev ?



remark - not include the OS , we talk here only on additional disks in HW machines



here is example of linux machine with UUID conf in fstab



/dev/mapper/vg00-loov_root / xfs defaults 00 
UUID=7de1dc5c-b605-4a6f-bdf1-f1e869f6ffb9 /boot xfs
defaults 0 0
/dev/mapper/vg00-loov_var /var xfs defaults 00
/dev/mapper/vg00-loov_swap swap swap defaults 00
UUID="fcb73644-4ad3-4b19-85f8-dbb9ed53a871" /data/sdb
ext4 defaults,noatime 0 0
UUID="5f56c1d6-266f-4ea2-a8f7-df06f08e01c0" /data/sdc
ext4 defaults,noatime 0 0
UUID="4c908671-4045-41e8-a396-a5198978e3ac" /data/sdd
ext4 defaults,noatime 0 0
UUID="d44fe62a-72dc-4674-91ac-5a1962797e22" /data/sde
ext4 defaults,noatime 0 0
UUID="ee3d8fa8-e000-4abb-a26c-da99499e630c" /data/sdf
ext4 defaults,noatime 0 0
UUID="61e9e16f-eb49-4c97-aaf0-0ed2dc3f3007" /data/sdg
ext4 defaults,noatime 0 0
UUID="ada12394-0e0b-4657-a148-d85548d7bc75" /data/sdh
ext4 defaults,noatime 0 0






share|improve this question














we need to add disks on more then 100 redhat machines,



therefore we need to update also the /etc/fstab on each machine



the problem is that some machines configured with UUID and other with ordinary dev in fstab



so I want to make a bash script that will identify the fstab configuration as the following



  1. in case fstab configured with UUID add new UUID lines for each additional disk

  2. in case fstab configured with ordinary dev then add new dev lines for each additional disk

so my question is - what is the best approach to identify what configured in fstab UUID or ordinary dev ?



remark - not include the OS , we talk here only on additional disks in HW machines



here is example of linux machine with UUID conf in fstab



/dev/mapper/vg00-loov_root / xfs defaults 00 
UUID=7de1dc5c-b605-4a6f-bdf1-f1e869f6ffb9 /boot xfs
defaults 0 0
/dev/mapper/vg00-loov_var /var xfs defaults 00
/dev/mapper/vg00-loov_swap swap swap defaults 00
UUID="fcb73644-4ad3-4b19-85f8-dbb9ed53a871" /data/sdb
ext4 defaults,noatime 0 0
UUID="5f56c1d6-266f-4ea2-a8f7-df06f08e01c0" /data/sdc
ext4 defaults,noatime 0 0
UUID="4c908671-4045-41e8-a396-a5198978e3ac" /data/sdd
ext4 defaults,noatime 0 0
UUID="d44fe62a-72dc-4674-91ac-5a1962797e22" /data/sde
ext4 defaults,noatime 0 0
UUID="ee3d8fa8-e000-4abb-a26c-da99499e630c" /data/sdf
ext4 defaults,noatime 0 0
UUID="61e9e16f-eb49-4c97-aaf0-0ed2dc3f3007" /data/sdg
ext4 defaults,noatime 0 0
UUID="ada12394-0e0b-4657-a148-d85548d7bc75" /data/sdh
ext4 defaults,noatime 0 0








share|improve this question













share|improve this question




share|improve this question








edited Jan 4 at 8:32

























asked Jan 3 at 23:55









yael

2,0091145




2,0091145











  • Why is it a problem that some systems do not use UUIDs yet? Is that anyhow an argument against UUIDs for the new disks?
    – Hauke Laging
    Jan 4 at 0:22






  • 3




    If you already have 100 machines that have inconsistent configuration styles then you have a bigger problem to solve first. You need to look into using something like puppet or ansible
    – cas
    Jan 4 at 1:58











  • what we want is to do the same conf on fstab I mean that if machine have UUID then need to insert UUID lines if machine have ordinary dev lines then need to insert DEV ordinary lines to fstan , all this to avoid mishmash on fstab file , it will not be good if fstab file will include both configuration isnt it?
    – yael
    Jan 4 at 5:47
















  • Why is it a problem that some systems do not use UUIDs yet? Is that anyhow an argument against UUIDs for the new disks?
    – Hauke Laging
    Jan 4 at 0:22






  • 3




    If you already have 100 machines that have inconsistent configuration styles then you have a bigger problem to solve first. You need to look into using something like puppet or ansible
    – cas
    Jan 4 at 1:58











  • what we want is to do the same conf on fstab I mean that if machine have UUID then need to insert UUID lines if machine have ordinary dev lines then need to insert DEV ordinary lines to fstan , all this to avoid mishmash on fstab file , it will not be good if fstab file will include both configuration isnt it?
    – yael
    Jan 4 at 5:47















Why is it a problem that some systems do not use UUIDs yet? Is that anyhow an argument against UUIDs for the new disks?
– Hauke Laging
Jan 4 at 0:22




Why is it a problem that some systems do not use UUIDs yet? Is that anyhow an argument against UUIDs for the new disks?
– Hauke Laging
Jan 4 at 0:22




3




3




If you already have 100 machines that have inconsistent configuration styles then you have a bigger problem to solve first. You need to look into using something like puppet or ansible
– cas
Jan 4 at 1:58





If you already have 100 machines that have inconsistent configuration styles then you have a bigger problem to solve first. You need to look into using something like puppet or ansible
– cas
Jan 4 at 1:58













what we want is to do the same conf on fstab I mean that if machine have UUID then need to insert UUID lines if machine have ordinary dev lines then need to insert DEV ordinary lines to fstan , all this to avoid mishmash on fstab file , it will not be good if fstab file will include both configuration isnt it?
– yael
Jan 4 at 5:47




what we want is to do the same conf on fstab I mean that if machine have UUID then need to insert UUID lines if machine have ordinary dev lines then need to insert DEV ordinary lines to fstan , all this to avoid mishmash on fstab file , it will not be good if fstab file will include both configuration isnt it?
– yael
Jan 4 at 5:47










1 Answer
1






active

oldest

votes

















up vote
0
down vote



accepted










You may have to define more precisely what counts as UUID configuration.



If it is enough that a single volume is mounted via UUID then you can simply use



if grep -q '^s*UUID=' /etc/fstab; then
:
else
:
fi





share|improve this answer




















  • not good , because in some linux machines the disk sda ( OS ) is with UUID , while other disks in machine are isn't
    – yael
    Jan 4 at 5:50










Your Answer







StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "106"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
convertImagesToLinks: false,
noModals: false,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);








 

draft saved


draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f414664%2fhow-to-identify-uuid-conf-or-ordinary-dev-conf-from-fstab%23new-answer', 'question_page');

);

Post as a guest






























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes








up vote
0
down vote



accepted










You may have to define more precisely what counts as UUID configuration.



If it is enough that a single volume is mounted via UUID then you can simply use



if grep -q '^s*UUID=' /etc/fstab; then
:
else
:
fi





share|improve this answer




















  • not good , because in some linux machines the disk sda ( OS ) is with UUID , while other disks in machine are isn't
    – yael
    Jan 4 at 5:50














up vote
0
down vote



accepted










You may have to define more precisely what counts as UUID configuration.



If it is enough that a single volume is mounted via UUID then you can simply use



if grep -q '^s*UUID=' /etc/fstab; then
:
else
:
fi





share|improve this answer




















  • not good , because in some linux machines the disk sda ( OS ) is with UUID , while other disks in machine are isn't
    – yael
    Jan 4 at 5:50












up vote
0
down vote



accepted







up vote
0
down vote



accepted






You may have to define more precisely what counts as UUID configuration.



If it is enough that a single volume is mounted via UUID then you can simply use



if grep -q '^s*UUID=' /etc/fstab; then
:
else
:
fi





share|improve this answer












You may have to define more precisely what counts as UUID configuration.



If it is enough that a single volume is mounted via UUID then you can simply use



if grep -q '^s*UUID=' /etc/fstab; then
:
else
:
fi






share|improve this answer












share|improve this answer



share|improve this answer










answered Jan 4 at 0:27









Hauke Laging

53.5k1282130




53.5k1282130











  • not good , because in some linux machines the disk sda ( OS ) is with UUID , while other disks in machine are isn't
    – yael
    Jan 4 at 5:50
















  • not good , because in some linux machines the disk sda ( OS ) is with UUID , while other disks in machine are isn't
    – yael
    Jan 4 at 5:50















not good , because in some linux machines the disk sda ( OS ) is with UUID , while other disks in machine are isn't
– yael
Jan 4 at 5:50




not good , because in some linux machines the disk sda ( OS ) is with UUID , while other disks in machine are isn't
– yael
Jan 4 at 5:50












 

draft saved


draft discarded


























 


draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f414664%2fhow-to-identify-uuid-conf-or-ordinary-dev-conf-from-fstab%23new-answer', 'question_page');

);

Post as a guest













































































Popular posts from this blog

How to check contact read email or not when send email to Individual?

Displaying single band from multi-band raster using QGIS

How many registers does an x86_64 CPU actually have?