[ccoss] Re: unmount cdrom, device is busy, what is using it,using fuser as a solution

  • From: Christopher Paulin <cpaulin@xxxxxxx>
  • To: ccoss@xxxxxxxxxxxxx
  • Date: Sat, 29 Nov 2003 21:25:38 -0500

  Bill wrote:

>One thing to keep in mind when copying CDs is that many times you can 
>just copy the iso image...no need to copy files at all...
>
>i.e. dd if=/dev/cdrom of=cdrom.iso
>
>then you can just use cdrecord to record cdrom.iso to a new CD.
>
Your suggestion worked. I also did MD5 comparison to make sure that the 
copied ISO was the same as the original CD's ISO.

These are the steps I took to copy a data CD.

First create an ISO image file from the CD.

chris@p450:/mnt/mandrake/home/chris_temp> dd if=/dev/cdrecorder 
of=cdrecorder.iso
905956+0 records in
905956+0 records out

Next, mount the ISO image file under /media/cdrecorder. This is from: 
"http://www.tldp.org/HOWTO/CD-Writing-HOWTO-3.html#ss3.1";.

chris@p450:/mnt/mandrake/home/chris_temp> mount -t iso9660 -o 
ro,loop=/dev/loop0 cdrecorder.iso /media/cdrecorder/
mount: only root can do that
chris@p450:/mnt/mandrake/home/chris_temp> su
Password:
p450:/mnt/mandrake/home/chris_temp # mount -t iso9660 -o 
ro,loop=/dev/loop0 cdrecorder.iso /media/cdrecorder/
p450:/mnt/mandrake/home/chris_temp # exit
exit

Next, see what files I mounted from the ISO image file.

p450:/mnt/mandrake/home/chris_temp # ls /media/cdrecorder/
.  ..  Autorun.ICO  Autorun.INF  IDE  Lan  Modem  Peripheral  Setup.exe  
Sound  USB  Utility  VGA

Next, create an MD5 sum file from the mounted ISO image files using 
relative paths.

chris@p450:/mnt/mandrake/home/chris_temp> (cd /media/cdrecorder; find . 
-type f -exec md5sum {} \; ) > dest.md5sum
chris@p450:/mnt/mandrake/home/chris_temp> more dest.md5sum
94dc6e3bd83b3cc2e1d222f70498d82d  ./Autorun.ICO
53206fb912c7c1033a172c811cea2260  ./Autorun.INF
035ea2a9ed956511eb1ef3d0bc70a2fe  ./IDE/Readme.txt
e9f2df528fd67e5e14344e75b5e7c1df  ./IDE/SiS96x/DATA.TAG
8238f44e8039dc9ad1b888ff94b036d0  ./IDE/SiS96x/DATA1.CAB
425bb489af8c2b061e773a1abf415163  ./IDE/SiS96x/DMASETUP/ATA133AP.EXE
bddd69c1736b33ae898df79d16109eff  ./IDE/SiS96x/DMASETUP/DMA98.EXE
750c075251274bb44996532c77244dbb  ./IDE/SiS96x/DMASETUP/HDINFO.EXE
b36455d752aaa0a41e3d31f8a433cd1e  ./IDE/SiS96x/DMASETUP/INFINSTALL.EXE
98de260969d153afc66b31a48d0a2338  ./IDE/SiS96x/DMASETUP/SISVSD.VXD
7286a38effa855e44299ef092877ea2c  ./IDE/SiS96x/IDEUTIL/SISIDE.EXE
a7093a506c924581a5490961e18b04fd  ./IDE/SiS96x/IDEUTIL/SISVSD.VXD
9d01735a2bc39e386908cde22f3840aa  ./IDE/SiS96x/INST2000.DLL
a7ff7146476a8a6518255f299b02cb1b  ./IDE/SiS96x/INSTFUNC.DLL
d0754bcefd6ee3ebc144beaf9e193332  ./IDE/SiS96x/LANG.DAT
72c582ab7db10af86a90608f98e5e614  ./IDE/SiS96x/LAYOUT.BIN
..........continued..........
chris@p450:/mnt/mandrake/home/chris_temp> su
Password:
p450:/mnt/mandrake/home/chris_temp # umount /media/cdrecorder/
p450:/mnt/mandrake/home/chris_temp # exit
exit

Next, mount the CD-ROM as you normally would.

chris@p450:/mnt/mandrake/home/chris_temp> mount /media/cdrecorder/

Next, create an MD5 sum file from the original mounted CD-ROM files 
using relative paths.

chris@p450:/mnt/mandrake/home/chris_temp> (cd /media/cdrecorder; find . 
-type f -exec md5sum {} \; ) > src.md5sum
chris@p450:/mnt/mandrake/home/chris_temp> more src.md5sum
94dc6e3bd83b3cc2e1d222f70498d82d  ./Autorun.ICO
53206fb912c7c1033a172c811cea2260  ./Autorun.INF
035ea2a9ed956511eb1ef3d0bc70a2fe  ./IDE/Readme.txt
e9f2df528fd67e5e14344e75b5e7c1df  ./IDE/SiS96x/DATA.TAG
8238f44e8039dc9ad1b888ff94b036d0  ./IDE/SiS96x/DATA1.CAB
425bb489af8c2b061e773a1abf415163  ./IDE/SiS96x/DMASETUP/ATA133AP.EXE
bddd69c1736b33ae898df79d16109eff  ./IDE/SiS96x/DMASETUP/DMA98.EXE
750c075251274bb44996532c77244dbb  ./IDE/SiS96x/DMASETUP/HDINFO.EXE
b36455d752aaa0a41e3d31f8a433cd1e  ./IDE/SiS96x/DMASETUP/INFINSTALL.EXE
98de260969d153afc66b31a48d0a2338  ./IDE/SiS96x/DMASETUP/SISVSD.VXD
7286a38effa855e44299ef092877ea2c  ./IDE/SiS96x/IDEUTIL/SISIDE.EXE
a7093a506c924581a5490961e18b04fd  ./IDE/SiS96x/IDEUTIL/SISVSD.VXD
9d01735a2bc39e386908cde22f3840aa  ./IDE/SiS96x/INST2000.DLL
a7ff7146476a8a6518255f299b02cb1b  ./IDE/SiS96x/INSTFUNC.DLL
d0754bcefd6ee3ebc144beaf9e193332  ./IDE/SiS96x/LANG.DAT
72c582ab7db10af86a90608f98e5e614  ./IDE/SiS96x/LAYOUT.BIN
..........continued..........
chris@p450:/mnt/mandrake/home/chris_temp> umount /media/cdrecorder/

Next, check that there are three files: the ISO image file, the ISO 
image file MD5 sum, and the CD-ROM MD5 sum.

chris@p450:/mnt/mandrake/home/chris_temp> ls -l
total 453788
-rw-r--r--    1 chris    users    463849472 2003-11-29 12:24 cdrecorder.iso
-rw-r--r--    1 chris    users      179035 2003-11-29 13:02 dest.md5sum
-rw-r--r--    1 chris    users      179035 2003-11-29 13:20 src.md5sum

Next, check that there are no differences between the two MD5 sum files; 
i.e., you made an exact copy.

chris@p450:/mnt/mandrake/home/chris_temp> diff src.md5sum dest.md5sum

Next, find out which SCSI device your CD-writer is attached to. This is 
from: "http://www.tldp.org/HOWTO/CD-Writing-HOWTO-3.html#ss3.1";.

chris@p450:/mnt/mandrake/home/chris_temp> cdrecord -scanbus
Cdrecord 1.11a28 (i686-suse-linux) Copyright (C) 1995-2002 Jörg Schilling
Linux sg driver version: 3.2.0
Using libscg version 'schily-0.6'
scsibus0:
        0,0,0     0) *
        0,1,0     1) *
        0,2,0     2) *
        0,3,0     3) *
        0,4,0     4) 'Seagate ' 'STT8000N        ' '3.22' Removable Tape
        0,5,0     5) *
        0,6,0     6) 'SyQuest ' 'EZ230S          ' '7220' Removable Disk
        0,7,0     7) *
scsibus1:
        1,0,0   100) 'SONY    ' 'DVD RW DRU-510A ' '1.0c' Removable CD-ROM
        1,1,0   101) *
        1,2,0   102) *
        1,3,0   103) *
        1,4,0   104) *
        1,5,0   105) *
        1,6,0   106) *
        1,7,0   107) *

Next, use the previous information (1,0,0) for the CD-writing command. 
This is from: "http://www.tldp.org/HOWTO/CD-Writing-HOWTO-3.html#ss3.1";.

chris@p450:/mnt/mandrake/home/chris_temp> cdrecord -v speed=16 dev=1,0,0 
-data cdrecorder.iso
Cdrecord 1.11a28 (i686-suse-linux) Copyright (C) 1995-2002 Jörg Schilling
TOC Type: 1 = CD-ROM
scsidev: '1,0,0'
scsibus: 1 target: 0 lun: 0
Linux sg driver version: 3.2.0
Using libscg version 'schily-0.6'
atapi: 1
Device type    : Removable CD-ROM
Version        : 0
Response Format: 2
Capabilities   :
Vendor_info    : 'SONY    '
Identifikation : 'DVD RW DRU-510A '
Revision       : '1.0c'
Device seems to be: Generic mmc2 DVD.
cdrecord: This version of cdrecord does not include DVD-R/DVD-RW support 
code.
cdrecord: If you need DVD-R/DVD-RW support, ask the Author for 
cdrecord-ProDVD.
Using generic SCSI-3/mmc CD-R driver (mmc_cdr).
Driver flags   : SWABAUDIO BURNFREE
Supported modes: TAO PACKET SAO SAO/R96R RAW/R96R
Drive buf size : 8112896 = 7922 KB
FIFO size      : 4194304 = 4096 KB
Track 01: data   442 MB
Total size:      508 MB (50:19.88) = 226491 sectors
Lout start:      508 MB (50:21/66) = 226491 sectors
Current Secsize: 2048
ATIP info from disk:
  Indicated writing power: 5
  Is not unrestricted
  Is not erasable
  Disk sub type: Medium Type A, high Beta category (A+) (3)
  ATIP start of lead in:  -11634 (97:26/66)
  ATIP start of lead out: 359846 (79:59/71)
Disk type:    Short strategy type (Phthalocyanine or similar)
Manuf. index: 3
Manufacturer: CMC Magnetics Corporation
Blocks total: 359846 Blocks current: 359846 Blocks remaining: 133355
Starting to write CD/DVD at speed 16 in real TAO mode for single session.
Last chance to quit, starting real write in 0 seconds. Operation starts.
Waiting for reader process to fill input buffer ... input buffer ready.
BURN-Free is ON.
Performing OPC...
Starting new track at sector: 0
Track 01:  442 of  442 MB written (fifo 100%) 17.9x.
Track 01: Total bytes read/written: 463849472/463849472 (226489 sectors).
Writing  time:  175.151s
Fixating...
Fixating time:   22.848s
cdrecord: fifo had 7307 puts and 7307 gets.
cdrecord: fifo was 0 times empty and 3433 times full, min fill was 90%.

Next, mount the CD-ROM and look to see if the copied files are there.

chris@p450:/mnt/mandrake/home/chris_temp> mount /media/cdrecorder/
chris@p450:/mnt/mandrake/home/chris_temp> ls /media/cdrecorder/
Autorun.ICO  Autorun.INF  IDE  Lan  Modem  Peripheral  Setup.exe  Sound  
USB  Utility  VGA
chris@p450:/mnt/mandrake/home/chris_temp> umount /media/cdrecorder/
chris@p450:/mnt/mandrake/home/chris_temp>

Christopher Paulin

>Cheers,
>
>Bill
>
>Christopher Paulin wrote:
>
>  
>
>>Bill wrote:
>>
>> 
>>
>>    
>>
>>>Cool. I think these tips are great! I wonder if we should create a 
>>>monthy (or even weekly) tip on www.ccoss.org? ?Half the battle of using 
>>>a computer effectively is knowing what can be done let alone what can do 
>>>what you need!
>>>
>>>Cheers
>>>
>>>   
>>>
>>>      
>>>
>>I was thinking the same thing except to include these in the Unix 
>>Utilities by Example document.
>>
>>Actually, what I was working on was copying a CD that came with a 
>>motherboard I installed for someone without using the Windows programs 
>>that came with my CD-recorder, and I found some things out about Linux 
>>on the way when I got stuck that I wanted to share with others and get 
>>advise for. That CD was not readable my the computer's CD-ROM I was 
>>working on but was with mine. That computer's CD-ROM works with other 
>>CDs ok. I realize now that I didn't need to copy it to the hard drive, 
>>but I didn't know how well the CD would read considering that it 
>>couldn't be read on the computer I worked on, so I now have a good copy 
>>according to the MD5 comparisons. Only one file didn't copy correctly 
>>the first time.
>>
>>For copying the CD, I've been following 
>>"http://www.tldp.org/HOWTO/CD-Writing-HOWTO-3.html#ss3.1";. I got to this 
>>command: "mkisofs  -r   -o cd_image   private_collection/", and I got an 
>>error when I ran it:
>>
>>chris@p450:/mnt/windows_xp/Documents and Settings> mkisofs -r -o 
>>cd_image temp_cd_copy/*
>>Using READM000.TXT;1 for  /Readme.txt (Readme.TXT)
>>Using READM001.TXT;1 for  /Readme.TXT (Readme.txt)
>>Using READM002.TXT;1 for  /Readme.txt (Readme.TXT)
>>Using READM003.TXT;1 for  /Readme.TXT (Readme.TXT)
>>Using READM004.TXT;1 for  /Readme.TXT (Readme.TXT)
>>Using READM005.TXT;1 for  /Readme.TXT (Readme.TXT)
>>mkisofs: Error: 'temp_cd_copy/usb/Readme.TXT' and 
>>'temp_cd_copy/Utility/Readme.TXT' have the same Rock Ridge name 
>>'Readme.TXT'.
>>mkisofs: Error: 'temp_cd_copy/Modem/Readme.TXT' and 
>>'temp_cd_copy/Lan/Readme.TXT' have the same Rock Ridge name 'Readme.TXT'.
>>mkisofs: Error: 'temp_cd_copy/Sound/Readme.TXT' and 
>>'temp_cd_copy/Modem/Readme.TXT' have the same Rock Ridge name 'Readme.TXT'.
>>mkisofs: Error: 'temp_cd_copy/usb/Readme.TXT' and 
>>'temp_cd_copy/Sound/Readme.TXT' have the same Rock Ridge name 'Readme.TXT'.
>>mkisofs: Error: 'temp_cd_copy/Utility/Readme.TXT' and 
>>'temp_cd_copy/Sound/Readme.TXT' have the same Rock Ridge name 'Readme.TXT'.
>>mkisofs: Unable to sort directory
>>chris@p450:/mnt/windows_xp/Documents and Settings>
>>
>>I got as far as finding out that this is a documented bug according to 
>>the author, Jörg Schilling, and trying to figure out how to update to 
>>cdtools-2.0. I never found out if this was fixed. After that, I took a 
>>break.
>>
>>Christopher Paulin
>>
>> 
>>
>>    
>>
>>>dave wrote:
>>>
>>>
>>>
>>>   
>>>
>>>      
>>>
>>>>you can also do this with the lsof (list open files) command:
>>>>
>>>>
>>>>
>>>>Christopher Paulin wrote:
>>>>
>>>>
>>>>  
>>>>
>>>>     
>>>>
>>>>        
>>>>
>>>>>Have you ever tried to unmount the CD-ROM, and it says the device is 
>>>>>busy. This is a solution to find out what process is using the CD-ROM.
>>>>>
>>>>>chris@p450:~> cat /etc/fstab
>>>>>.....................
>>>>>/dev/cdrecorder      /media/cdrecorder    auto       
>>>>>ro,noauto,user,exec   0 0
>>>>>.....................
>>>>>chris@p450:~> ls -l /dev/cdrecorder
>>>>>lrwxrwxrwx    1 root     root            3 2003-10-13 21:35 
>>>>>/dev/cdrecorder -> sr0
>>>>>chris@p450:~> fuser -m /dev/sr0
>>>>>/dev/sr0:             1247
>>>>>chris@p450:~> fuser -m /dev/cdrecorder
>>>>>/dev/cdrecorder:      1247
>>>>> 
>>>>>
>>>>>    
>>>>>
>>>>>       
>>>>>
>>>>>          
>>>>>
>>>_______________________________________________
>>>CCOSS mailing list
>>>ccoss@xxxxxxxxxxxxx
>>>CCOSS mailing list page: //www.freelists.org/cgi-bin/list?list_id=3594
>>>CCOSS Web page: http://www.ccoss.org
>>>
>>>
>>>
>>>   
>>>
>>>      
>>>
>>_______________________________________________
>>CCOSS mailing list
>>ccoss@xxxxxxxxxxxxx
>>CCOSS mailing list page: //www.freelists.org/cgi-bin/list?list_id=3594
>>CCOSS Web page: http://www.ccoss.org
>>
>> 
>>
>>    
>>
>
>
>_______________________________________________
>CCOSS mailing list
>ccoss@xxxxxxxxxxxxx
>CCOSS mailing list page: //www.freelists.org/cgi-bin/list?list_id=3594
>CCOSS Web page: http://www.ccoss.org
>
>  
>


_______________________________________________
CCOSS mailing list
ccoss@xxxxxxxxxxxxx
CCOSS mailing list page: //www.freelists.org/cgi-bin/list?list_id=3594
CCOSS Web page: http://www.ccoss.org

Other related posts: