how to identify UUID conf or ordinary dev conf from fstab
Clash 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
- in case fstab configured with UUID add new UUID lines for each additional disk
- 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
shell-script fstab uuid
add a comment |Â
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
- in case fstab configured with UUID add new UUID lines for each additional disk
- 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
shell-script fstab uuid
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
add a comment |Â
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
- in case fstab configured with UUID add new UUID lines for each additional disk
- 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
shell-script fstab uuid
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
- in case fstab configured with UUID add new UUID lines for each additional disk
- 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
shell-script fstab uuid
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
add a comment |Â
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
add a comment |Â
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
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
add a comment |Â
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
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
add a comment |Â
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
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
add a comment |Â
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
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
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
add a comment |Â
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
add a comment |Â
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
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
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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