- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - Linux
- >
- need help to unmount file systems via script
Operating System - Linux
1753537
Members
4750
Online
108795
Solutions
Forums
Categories
Company
Local Language
back
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Discussions
back
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
Blogs
Information
Community
Resources
Community Language
Language
Forums
Blogs
Go to solution
Topic Options
- 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
03-16-2009 08:52 PM
03-16-2009 08:52 PM
cat /proc/mounts | grep "/dev/disk/by-path/ip-"
/dev/disk/by-path/ip-192.168.0.206:3260-iscsi-iqn.2009-03.com.test:0ad96cc0-32f7-4804-a73c-11505b43db90-lun-0-part1 /ap_logs reiserfs rw 0 0
/dev/disk/by-path/ip-192.168.0.206:3260-iscsi-iqn.2009-03.com.test:f3b18583-2e34-470d-8993-96a36217d711-lun-0-part1 /db_logs reiserfs rw 0 0
/dev/disk/by-path/ip-192.168.0.206:3260-iscsi-iqn.2009-03.com.test:cb6ca23d-0ca2-40df-bfb3-feccbe8bfd6b-lun-0-part1 /ora reiserfs rw 0 0
I want to write a script that unmounts all of the iSCSI LUNS
#!/bin/bash
cat /proc/mounts | grep "/dev/disk/by-path/ip-"
if [ "$?" == "0" ]
then echo "iSCSI LUNS are mounted...Unmounting all of the mounted iSCSI LUNS"
############################################
## here I need forum's help(script code), I
## mean how I can unmount all of the mounted
## iSCSI LUNS
############################################
else echo "iSCSI LUNS not mounted"
fi
Regards
/dev/disk/by-path/ip-192.168.0.206:3260-iscsi-iqn.2009-03.com.test:0ad96cc0-32f7-4804-a73c-11505b43db90-lun-0-part1 /ap_logs reiserfs rw 0 0
/dev/disk/by-path/ip-192.168.0.206:3260-iscsi-iqn.2009-03.com.test:f3b18583-2e34-470d-8993-96a36217d711-lun-0-part1 /db_logs reiserfs rw 0 0
/dev/disk/by-path/ip-192.168.0.206:3260-iscsi-iqn.2009-03.com.test:cb6ca23d-0ca2-40df-bfb3-feccbe8bfd6b-lun-0-part1 /ora reiserfs rw 0 0
I want to write a script that unmounts all of the iSCSI LUNS
#!/bin/bash
cat /proc/mounts | grep "/dev/disk/by-path/ip-"
if [ "$?" == "0" ]
then echo "iSCSI LUNS are mounted...Unmounting all of the mounted iSCSI LUNS"
############################################
## here I need forum's help(script code), I
## mean how I can unmount all of the mounted
## iSCSI LUNS
############################################
else echo "iSCSI LUNS not mounted"
fi
Regards
Solved! Go to Solution.
1 REPLY 1
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-16-2009 11:00 PM
03-16-2009 11:00 PM
Solution
Hi,
I don't have iscsi, but in fstab or /proc/mounts you have the mount point in position 2, so why not something like
for i in `cat /proc/mounts | grep "/dev/disk/by-path/ip-" | awk '{ print $2 }'
do
umount $i
if [ "$?" == "0" ]
then
echo "iSCSI LUNS umounted"
fi
done
I don't have iscsi, but in fstab or /proc/mounts you have the mount point in position 2, so why not something like
for i in `cat /proc/mounts | grep "/dev/disk/by-path/ip-" | awk '{ print $2 }'
do
umount $i
if [ "$?" == "0" ]
then
echo "iSCSI LUNS umounted"
fi
done
The opinions expressed above are the personal opinions of the authors, not of Hewlett Packard Enterprise. By using this site, you accept the Terms of Use and Rules of Participation.
News and Events
Support
© Copyright 2024 Hewlett Packard Enterprise Development LP