- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- How to unlock a locked cdrom
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
Discussions
Discussions
Discussions
Forums
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
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
тАО03-31-2006 09:04 AM
тАО03-31-2006 09:04 AM
How to unlock a locked cdrom
In a previous thread Stephen Keane, mentioned a firmware lock and a C program to unlock a cdrom whic was complaining of being locked or busy, even when the cdrom was not in use.
http://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=886017
Can someone share this program or sample.
This server can not be rebooted and we'll attempt to unlock the CDROM online.
Thanks in Advance!
David
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-31-2006 02:01 PM
тАО03-31-2006 02:01 PM
Re: How to unlock a locked cdrom
Whenever the mounted CDROM filesystem is opened, a SCSI lock is sent to the drive to logically lock the drive so the CD cannot be ejected while the filesystem is busy. Actually, the lock just disables the pushbutton and the SCSI command that can eject the CD HP-UX does not have an unload command). Different than PCs, a mounted filesystem is integrated into the root filesystem so pulling out the CD can cause system crashes, thus the lock.
That said, fuser is still very poor at tracking down all the possible ways a CD is being used. For instance, the CD may have been exported as an NFS or CIFS filesystem. So if fuser shows nothing, you'll need lsof to track down the processes. Download lsof from the HP-UX archive:
http://hpux.connect.org.uk/
Once lsof reports no processes associated with the CD's then umount should work and the CD will be released. If not, the drive's firmware may be confused so you can use a paper clip to manually pop open the CD drawer. WARNING: if process(es) are still shown active by lsof (or if you can't use lsof), popping out the CD manually may cause system hangs (typically, logins, the bdf and df commands, etc). If you put in a different CD to stop the hangs, the system will likely crash due to a complete mismatch in the filesystem. When the system is rebooted, the SCSI reset command is sent to all disk (and CDROM) devices which removes the SCSI lock.
By the way, you weren't using PFS were you? This product is deprecated (not recommended) and known to be unstable in some situations. Get the Rock Ridge patches if your HP-UX system is 11.00 or later.
Bill Hassell, sysadmin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-03-2006 08:42 AM
тАО04-03-2006 08:42 AM
Re: How to unlock a locked cdrom
David
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-03-2006 09:02 AM
тАО04-03-2006 09:02 AM
Re: How to unlock a locked cdrom
#include
#include
#include
#include
#include
unsigned char UNLOCK = 0x1E; // Prevent/Allow Media Removal
unsigned char UNLOCK_CMD_LEN = 6; // Bytes
unsigned int SCSI_TIMEOUT = 5000; // Milliseconds
main(argc, argv)
int argc;
char * argv[];
{
int fd, i, rc;
struct sctl_io si;
if (argc != 2)
{
fprintf(stderr, "Usage : %s cd_device\n", argv[0]);
exit(1);
}
fd = open(argv[1], O_RDONLY | O_NDELAY);
if (fd == -1)
{
fprintf(stderr, "Failed to open %s because %s\n",
argv[1], strerror(errno));
exit(1);
}
memset(&si, 0, sizeof(si));
si.flags = 0;
si.cdb_length = UNLOCK_CMD_LEN;
si.cdb[0] = UNLOCK;
si.max_msecs = SCSI_TIMEOUT;
rc = ioctl(fd, SIOC_IO, &si);
if (rc != 0)
{
fprintf(stderr, "ioctl(SIOC_IO) error %s\n", strerror(errno));
(void) close(fd);
exit(1);
}
if (si.cdb_status != S_GOOD)
{
fprintf(stderr, "SCSI error\n");
if (si.sense_xfer != 0)
{
fprintf(stderr, "with sense data ");
for (i = 0; i < (int) si.sense_xfer; i++)
{
fprintf(stderr, "%2.2x ", si.sense[i]);
}
fprintf(stderr, "\n");
}
(void) close(fd);
exit(1);
}
(void) close(fd);
/* success !! */
printf("Drive %s unlocked\n", argv[1]);
exit(0);
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-03-2006 09:04 AM
тАО04-03-2006 09:04 AM
Re: How to unlock a locked cdrom
Hope it helps for you
#include
#include
#include
#include
#include
unsigned char UNLOCK = 0x1E; // Prevent/Allow Media Removal
unsigned char UNLOCK_CMD_LEN = 6; // Bytes
unsigned int SCSI_TIMEOUT = 5000; // Milliseconds
main(argc, argv)
int argc;
char * argv[];
{
int fd, i, rc;
struct sctl_io si;
if (argc != 2)
{
fprintf(stderr, "Usage : %s cd_device\n", argv[0]);
exit(1);
}
fd = open(argv[1], O_RDONLY | O_NDELAY);
if (fd == -1)
{
fprintf(stderr, "Failed to open %s because %s\n",
argv[1], strerror(errno));
exit(1);
}
memset(&si, 0, sizeof(si));
si.flags = 0;
si.cdb_length = UNLOCK_CMD_LEN;
si.cdb[0] = UNLOCK;
si.max_msecs = SCSI_TIMEOUT;
rc = ioctl(fd, SIOC_IO, &si);
if (rc != 0)
{
fprintf(stderr, "ioctl(SIOC_IO) error %s\n", strerror(errno));
(void) close(fd);
exit(1);
}
if (si.cdb_status != S_GOOD)
{
fprintf(stderr, "SCSI error\n");
if (si.sense_xfer != 0)
{
fprintf(stderr, "with sense data ");
for (i = 0; i < (int) si.sense_xfer; i++)
{
fprintf(stderr, "%2.2x ", si.sense[i]);
}
fprintf(stderr, "\n");
}
(void) close(fd);
exit(1);
}
(void) close(fd);
/* success !! */
printf("Drive %s unlocked\n", argv[1]);
exit(0);
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-03-2006 07:11 PM
тАО04-03-2006 07:11 PM
Re: How to unlock a locked cdrom
fuser
to get the PID on which mount_point is used.
This sometimes is not enough, and you can try using lsof free software to get this information.
http://hpux.connect.org.uk/hppd/hpux/Sysadmin/lsof-4.76/
Once process is identified, see if you can stop ( or kill) it to free device.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-03-2006 08:10 PM
тАО04-03-2006 08:10 PM
Re: How to unlock a locked cdrom
Hi david,
find all the processes which is using the cdrom using fuser or lsof.
kill all the proceses and try umount cdrom
cheers!!
sysadm
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-05-2006 08:00 AM
тАО04-05-2006 08:00 AM
Re: How to unlock a locked cdrom
If you planning to use fuser try to use -c
Display the use of a mount point and any file beneath that mount point. I hope it helps