Author Topic: [SOLVED] - disk in CD drive not 'seen' by file manager when using 'copy to ram'  (Read 739 times)

codeapro

  • Guest
After booting from remastered CD the disk just booted from is not shown within any of the file manager applications (only occurs when choosing copy to ram option). 

Historic posts show a work round by manually ejecting the CD using the 'eject' command from the shell.  When using this method any new CD inserted into the drive is not registered so does not show in the file manager.

To fix the problem one of the lines in the 'linuxrc' script (found in the '/usr/share/mylivecd' directory) needs to be moved.

In the extract below I have highlighted the line that need to be moved  with '#####   Move this line from here --->'

and shown the new location with '#######  <------ To this new position  ######'

Extract of the relevant portion of the file shown below for clarity:

                                else
                                        ## Yes, we got it!
                                        # do we want copy2ram?
                                        toram=`grep -iq copy2ram /proc/cmdline && echo 1`
                                        if [ -n "$toram" ]; then
                                                RAMDIR="/initrd/livecd.ram"
                                                mkdir -p $RAMDIR
                                                # make sure we have enough room for the image
                                                IMAGESIZE=`ls -l $MNTCDROM/livecd.sqfs | awk '{print $5+1000000}'`
                                                mount -t tmpfs -o "size=$IMAGESIZE" tmpfs $RAMDIR
                                                if [ "$?" -eq 0 ]; then
                                                        # copy the livecd.sqfs image to a tmpfs directory to be used as the new MNTCDROM
                                                        echo -n
                                                        echo -n " Copying to memory, please stand by..."
                                                        cp -R $MNTCDROM/livecd.sqfs $RAMDIR
                                                        if [ "$?" -eq 0 ]; then
                                                                printok
                                                                # free the boot device
                                                                umount $MNTLIVECD
                        #####   Move this line from here --->   umount $MNTCDROM
                                                                # and use our new directory as the new MNTLIVECD
                                                                `losetup -d $DEVLOOP 2>&1 >/dev/null`
                                                                losetup $DEVLOOP $RAMDIR/livecd.sqfs
                                                                mount -r -t squashfs $DEVLOOP $MNTLIVECD
                                                                rm -rf /initrd/sbin/halt.local
                                                                umount $MNTCDROM          #######  <------ To this new position  ######
                                                        else
                                                                `umount $RAMDIR 2>&1 >/dev/null`
                                                                echo -n "copy 2 ram was unsuccesfull"
                                                                printfail
                                                        fi
                                                else
                                                        `umount $RAMDIR 2>&1 >/dev/null`
                                                        echo -n "the iso is larger than the available ram"
                                                        printfail
                                                fi
                                        fi


(The version control identifier of the script amended is '$Id: linuxrc.in,v 0.9.0 2010/02/24 03:33:00 texstar Exp $', if the version of the script you have is different your mileage may vary).

Make the change then remaster your CD.  Now when booted of the newly remastered CD when you open a file manager the CD is shown and can be ejected using the GUI.  Any new CD inserted is also registered and shows within the file manager.
 

Offline Texstar

  • Administrator
  • Super Villain
  • *****
  • Posts: 12539
After booting from remastered CD the disk just booted from is not shown within any of the file manager applications (only occurs when choosing copy to ram option). 

Historic posts show a work round by manually ejecting the CD using the 'eject' command from the shell.  When using this method any new CD inserted into the drive is not registered so does not show in the file manager.

To fix the problem one of the lines in the 'linuxrc' script (found in the '/usr/share/mylivecd' directory) needs to be moved.

In the extract below I have highlighted the line that need to be moved  with '#####   Move this line from here --->'

and shown the new location with '#######  <------ To this new position  ######'

Extract of the relevant portion of the file shown below for clarity:

                                else
                                        ## Yes, we got it!
                                        # do we want copy2ram?
                                        toram=`grep -iq copy2ram /proc/cmdline && echo 1`
                                        if [ -n "$toram" ]; then
                                                RAMDIR="/initrd/livecd.ram"
                                                mkdir -p $RAMDIR
                                                # make sure we have enough room for the image
                                                IMAGESIZE=`ls -l $MNTCDROM/livecd.sqfs | awk '{print $5+1000000}'`
                                                mount -t tmpfs -o "size=$IMAGESIZE" tmpfs $RAMDIR
                                                if [ "$?" -eq 0 ]; then
                                                        # copy the livecd.sqfs image to a tmpfs directory to be used as the new MNTCDROM
                                                        echo -n
                                                        echo -n " Copying to memory, please stand by..."
                                                        cp -R $MNTCDROM/livecd.sqfs $RAMDIR
                                                        if [ "$?" -eq 0 ]; then
                                                                printok
                                                                # free the boot device
                                                                umount $MNTLIVECD
                        #####   Move this line from here --->   umount $MNTCDROM
                                                                # and use our new directory as the new MNTLIVECD
                                                                `losetup -d $DEVLOOP 2>&1 >/dev/null`
                                                                losetup $DEVLOOP $RAMDIR/livecd.sqfs
                                                                mount -r -t squashfs $DEVLOOP $MNTLIVECD
                                                                rm -rf /initrd/sbin/halt.local
                                                                umount $MNTCDROM          #######  <------ To this new position  ######
                                                        else
                                                                `umount $RAMDIR 2>&1 >/dev/null`
                                                                echo -n "copy 2 ram was unsuccesfull"
                                                                printfail
                                                        fi
                                                else
                                                        `umount $RAMDIR 2>&1 >/dev/null`
                                                        echo -n "the iso is larger than the available ram"
                                                        printfail
                                                fi
                                        fi


(The version control identifier of the script amended is '$Id: linuxrc.in,v 0.9.0 2010/02/24 03:33:00 texstar Exp $', if the version of the script you have is different your mileage may vary).

Make the change then remaster your CD.  Now when booted of the newly remastered CD when you open a file manager the CD is shown and can be ejected using the GUI.  Any new CD inserted is also registered and shows within the file manager.
 

GREAT! Thank you bro!


Thanks to everyone who donates. You keep the servers running.