- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - Linux
- >
- Show disk ioscan in one line
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-25-2006 11:53 PM
10-25-2006 11:53 PM
So far I managed to do as below and include it in my script.
/usr/sbin/ioscan -fnCdisk |grep -v "Class" |/usr/bin/awk '{print $1" "$5" "$6" "$7" "$8" "$2" "$3" "$4"="}'|/usr/bin/sed -e :a -e '/sdisk=/N; s/sdisk=\n//; ta' |/usr/bin/awk '{print $1":"$2":"$3":"$4":"$5":"$6":"$7":"$8":"$9}' |grep -v "="
However, this wont work if there is no device file for the hardware.
Anyone has a better solution?
Thanks.
Nash
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-25-2006 11:59 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-25-2006 11:59 PM
10-25-2006 11:59 PM
Re: Show disk ioscan in one line
When parsing the output of 'ioscan', using its '-F' option to produce colon-delimited fields eases the burden, particularly since missing fields are bounded by consecutive colons.
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-26-2006 12:05 AM
10-26-2006 12:05 AM
Re: Show disk ioscan in one line
Yes, -F option eases the burden but the the device files are still shown in a separate line.
Thanks.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-26-2006 12:08 AM
10-26-2006 12:08 AM
Re: Show disk ioscan in one line
I will find myself an awk book.
Thanks.
p.s. Next task - combine vgdisplay, diskinfo and ioscan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-26-2006 12:59 AM
10-26-2006 12:59 AM
Re: Show disk ioscan in one line
But extracting the disks' paths is quite simple (piped to head for brevity)
$ /usr/sbin/ioscan -kFdsdisk|awk -F: '/CLAIMED/&&!/DVD|CD|SUBDISK/{print$11}'|head
0/0/1/1.2.0
0/0/2/0.0.0
0/0/2/0.2.0
0/10/0/0.107.21.19.0.0.0
0/10/0/0.107.21.19.0.0.1
0/10/0/0.107.21.19.0.0.2
0/10/0/0.107.21.19.0.0.3
0/10/0/0.107.21.19.0.0.4
0/10/0/0.107.21.19.0.0.5
0/10/0/0.107.21.19.0.0.6
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-26-2006 01:07 AM
10-26-2006 01:07 AM
Re: Show disk ioscan in one line
Output using awk uses a space as the default field separator. Hence:
# echo "1 2 3"|awk '{print $1" "$2" "$3}'
...is better written as:
# echo "1 2 3"|awk '{print $1,$2,$3}'
The comma indictes the interposition of the output separator.
You can change the default space separtor to any character you need by setting the OFS value like this:
# echo "1 2 3"|awk 'BEGIN{OFS="."};{print $1,$2,$3}'
...which produces the output:
1.2.3
A free, very nice tutorial to 'awk' can be found here:
http://www.gnu.org/software/gawk/manual/gawk.html
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-26-2006 01:15 AM
10-26-2006 01:15 AM
Re: Show disk ioscan in one line
The controller or card No. (well the digits after the c in /dev/dsk/c?t?d?) can be taken from the instance Nos. that ext_bus class like
$ /usr/sbin/ioscan -kFCext_bus|awk -F: '$10~/fcparray|c720/{printf"%2d %s\n",$13,$11}'
0 0/0/1/0
1 0/0/1/1
2 0/0/2/0
3 0/0/2/1
11 0/10/0/0.107.21.19.0
4 0/12/0/0.117.6.19.0
The target and device or lun part is simply the last to period delimited digits of the disk paths' from my first posting.
But don't despair, the Solaris device tree even sucks more ;-)
HTH
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-27-2006 12:03 PM
11-27-2006 12:03 PM
Re: Show disk ioscan in one line
Nash