LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 12-04-2023, 07:26 AM   #1
SabrinaFu
LQ Newbie
 
Registered: Dec 2023
Posts: 2

Rep: Reputation: 0
Mapping to a server disk: scsi vs regular disk


Hi, I work on software that formats and uses a disk on linux. When discovering the disks, we look for a non formatted disk with fdisk -l.

Ex:
If /dev/sda is formatted and /dev/sdb is not formatted, we use sdb.

For a server that's not on the cloud i have a question:

If we discover a scsi disk and a lun symlink to /dev/sdb, should we use that lun or the disk ?

I have noticed that many disks can be mapped to the same lun. This poses a problem.
 
Old 12-04-2023, 03:27 PM   #2
des_a
Senior Member
 
Registered: Sep 2006
Posts: 1,441
Blog Entries: 43

Rep: Reputation: 36
https://unix.stackexchange.com/quest...-symbolic-link

Test somewhere in your code, if the file is a symlink or not, with:

Code:
[ -L <file> ]
 
Old 12-04-2023, 04:51 PM   #3
rkelsen
Senior Member
 
Registered: Sep 2004
Distribution: slackware
Posts: 4,466
Blog Entries: 7

Rep: Reputation: 2562Reputation: 2562Reputation: 2562Reputation: 2562Reputation: 2562Reputation: 2562Reputation: 2562Reputation: 2562Reputation: 2562Reputation: 2562Reputation: 2562
Quote:
Originally Posted by SabrinaFu View Post
I have noticed that many disks can be mapped to the same lun. This poses a problem.
Yeah, this shouldn't happen. What distribution are you using?
 
Old 12-07-2023, 06:58 AM   #4
SabrinaFu
LQ Newbie
 
Registered: Dec 2023
Posts: 2

Original Poster
Rep: Reputation: 0
I work on azure VMs that have a scsi and 3 disks. But i'm trying to guess how it would be on premise outside the cloud.

Apparently this command show you the mappings. I found out that the last digit is the lun?

rgadmin@ubuntu22:~$ ls -ld /sys/block/sd*/device
lrwxrwxrwx 1 root root 0 Nov 30 11:23 /sys/block/sda/device -> ../../../0:0:0:0
lrwxrwxrwx 1 root root 0 Nov 30 11:24 /sys/block/sdb/device -> ../../../2:0:0:0
lrwxrwxrwx 1 root root 0 Nov 30 11:24 /sys/block/sdc/device -> ../../../2:0:0:1

So I see here that sda, sdb is on lun 0, sdc is on lun1.

Azure then has this file with symlinks. It excludes sda which is the disk that contains the OS.

rgadmin@ubuntu22:~$ ls -al /dev/disk/azure/scsi1
total 0
drwxr-xr-x 2 root root 60 Nov 30 11:46 .
drwxr-xr-x 3 root root 140 Nov 30 11:24 ..
lrwxrwxrwx 1 root root 12 Nov 30 11:46 lun0 -> ../../../sdb
lrwxrwxrwx 1 root root 12 Nov 30 11:46 lun1 -> ../../../sdc

Last edited by SabrinaFu; 12-08-2023 at 02:32 AM.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Mapping /proc/scsi/scsi entries with respective device names in /dev/ directory neo3matrix Red Hat 2 04-21-2011 06:56 AM
Hotplug SCSI scanner or How to write to /proc/scsi/scsi from within a shell script. samac Linux - Hardware 1 08-30-2004 02:28 PM
use ide-scsi to emulate an ide disk as a scsi disk free_ok_man Linux - Software 1 07-01-2003 05:08 PM
use ide-scsi to emulate an ide disk as a scsi disk free_ok_man Linux - Newbie 1 07-01-2003 03:51 AM
physical scsi channel mapping to scsiX device node mapping, how to configure manually drthornt Linux - Hardware 3 02-09-2003 11:50 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 08:32 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration