-1

We have RedHat servers.

How can we determine if a physical Linux server is booting from SAN or has a local disk?

Which files can indicate this?

I ask because we need to perform some configuration only on the servers that boot from SAN.

1 Answer 1

2

To find which drive is your boot device.

lsblk | grep /boot 

Then when you know the name of your device

ls -l /sys/block/sda

It wil return something like:

lrwxrwxrwx 1 root root 0 Mar 30 09:27 /sys/block/sda -> ../devices/pci0000:00/0000:00:10.0/host2/target2:0:0/2:0:0:0/block/sda   

Where 00:10.0 is your device ID. And now when you know which device you are exactly looking for you kan issue:

lspci | grep "00:10.0" 

If you cant find it it means that device is not attached locally. I think it's obvious that you can easily script this process.

3
  • we cant use this command because yum not find this command in our repositories
    – yael
    Commented Mar 30, 2017 at 9:34
  • ls -l /sys/block/sda To find device symlinks and where they point to. You will get something like: lrwxrwxrwx 1 root root 0 Mar 30 09:27 /sys/block/sda -> ../devices/pci0000:00/0000:00:10.0/host2/target2:0:0/2:0:0:0/block/sda And with lspci you can examin if its attached locally. Just serch for itst id.
    – nethero
    Commented Mar 30, 2017 at 9:44
  • So to recap: First lsblk to find on which drive is your /boot. Then ls -l /sys/block/yourbootdrive (in my case it was sda) Then you extract your device id in my case it was pci:0000:00:10 Then you look for your id in lspci to know if its phisically attached to the server you examine. Tell me if it helped so i could edit my answer.
    – nethero
    Commented Mar 30, 2017 at 9:51

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .