
Hi,
sometimes I booted grml, started a job there (like using dd to zero a partition) and then have to leave (but let it try continuing the zeroing). So I want to remove the CD (and risk a panic later when a file from it is accessed). But that is no problem since I do not run anything new after the CD is removed, so everything needed is already in cache. For these cases I have a perl script on my USB pendrive:
#!/usr/bin/perl -w open(H, "</dev/cdrom") or die("Can't open: $!"); ioctl(H, 0x5329 , 0) or die("Can't ioctl: $!"); close(H) or die("Can't close: $!");
That one works well - if I have my pendrive with me. My question: Is there a way inside grml to do the same thing (without memorizing the whole script or the ioctl number)? Something in /proc or /sys? Or a script? (Using the hardware eject "hole" of the CD drive does not count, since it requires a paper clip ;-) )
TIA,
Michael

* Michael Schierl schierlm@gmx.de [20061113 21:47]:
sometimes I booted grml, started a job there (like using dd to zero a partition) and then have to leave (but let it try continuing the zeroing). So I want to remove the CD (and risk a panic later when a file from it is accessed). But that is no problem since I do not run anything new after the CD is removed, so everything needed is already in cache. For these cases I have a perl script on my USB pendrive:
#!/usr/bin/perl -w open(H, "</dev/cdrom") or die("Can't open: $!"); ioctl(H, 0x5329 , 0) or die("Can't ioctl: $!"); close(H) or die("Can't close: $!");
That one works well - if I have my pendrive with me. My question: Is there a way inside grml to do the same thing (without memorizing the whole script or the ioctl number)? Something in /proc or /sys? Or a script? (Using the hardware eject "hole" of the CD drive does not count, since it requires a paper clip ;-) )
I'm running out of coffee, but are you searching for http://grml.org/faq/#remove_cd ?
regards, -mika-

On Mon, Nov 13, 2006 at 09:51:51PM +0100, Michael Prokop wrote:
I'm running out of coffee, but are you searching for http://grml.org/faq/#remove_cd ?
In case you have enough RAM, running "grml toram" should probably help too i guess? Never used it myself but it should also take care of the problems arising when you need to access some file from the cdrom/pen drive as it's not needed.
cheers, Wernfried

[Forwarding the mail for Michael Schierl, as gmx was on the blacklist too, http://www.rfc-ignorant.org/tools/lookup.php?domain=mail.gmx.net ]
* Wernfried Haas amne@gentoo.org [20061114 11:15]:
On Mon, Nov 13, 2006 at 09:51:51PM +0100, Michael Prokop wrote:
I'm running out of coffee, but are you searching for http://grml.org/faq/#remove_cd ?
In case you have enough RAM, running "grml toram" should probably help too i guess? Never used it myself but it should also take care of the problems arising when you need to access some file from the cdrom/pen drive as it's not needed.
,---- [ fwd from Michael Schierl's mail ] | "grml toram" only helps if I think about it first, not when the job is | already running and the hard disk is slower than you expected. And there | are still too many PCs with only 256MB or even 128MB RAM around :) | | Unfortunately, doing "grml toram" while the system is working does not | work. Even if you copy the image file to tmpfs and add it to the union, | you cannot unmount the original image file since open file references | will not "jump" to the new location. [I already asked this on the | unionfs list, but got no hints how to do it, so I think this is | impossible :( ]. And losetup cannot "move" a loop-mounted file (while | mounted) either. And I don't know any other way how to archieve this. | | But umount -l is a good idea, thanks :) | | Michael `----
regards, -mika-

Michael Schierl wrote:
In case you have enough RAM, running "grml toram" should probably help too i guess?
And losetup cannot "move" a loop-mounted file (while mounted) either. And I don't know any other way how to archieve this.
When digging through the Linux code, it seems that loopback devices support moving loop-mounted files around - it is just that I do not know any userspace tool that makes the LOOP_CHANGE_FD ioctl available to its users.
But, doing something like
----- #!/bin/sh cp /cdrom/GRML/GRML /tmp perl <<'EOF' open LOOP, '</dev/loop0' or die $!; open DEST, '</tmp/GRML' or die $!; ioctl(LOOP, 0x4C06, fileno(DEST)) or die $! close LOOP; close DEST; EOF umount /cdrom -----
works fine, as long as you have enough RAM (tested in a virtual machine with grml-small 0.3).
How about putting this (or similar) into a grml-toram script?
Michael

* Michael Schierl schierlm-public@gmx.de [20061210 20:15]:
Michael Schierl wrote:
And losetup cannot "move" a loop-mounted file (while mounted) either. And I don't know any other way how to archieve this.
When digging through the Linux code, it seems that loopback devices support moving loop-mounted files around - it is just that I do not know any userspace tool that makes the LOOP_CHANGE_FD ioctl available to its users.
But, doing something like
#!/bin/sh cp /cdrom/GRML/GRML /tmp perl <<'EOF' open LOOP, '</dev/loop0' or die $!; open DEST, '</tmp/GRML' or die $!; ioctl(LOOP, 0x4C06, fileno(DEST)) or die $! close LOOP; close DEST; EOF umount /cdrom
works fine, as long as you have enough RAM (tested in a virtual machine with grml-small 0.3).
How about putting this (or similar) into a grml-toram script?
Wonderful idea!
I've added a script named grml2ram which is based on your script to package grml-scripts:
http://hg.grml.org/grml-scripts/rev/7f265425dec1e56bcf711c449bfbca7f54f7145a
thx && regards, -mika-

Michael Prokop schrieb:
I've added a script named grml2ram which is based on your script to package grml-scripts:
http://hg.grml.org/grml-scripts/rev/7f265425dec1e56bcf711c449bfbca7f54f7145a
Fine! Did not know that rsync can do --progress :)
BTW: Are there any generic "progress indicator" scripts or programs on the grml CD? Something to put into a pipe (e. g. between »dd if=/some/disk« and netcat) to see how much data flows through it? Anything from nice bars to just a KB/MB/GB counter would be nice.
Michael

* Michael Schierl schierlm-public@gmx.de [20061212 21:15]:
Michael Prokop schrieb:
I've added a script named grml2ram which is based on your script to package grml-scripts:
http://hg.grml.org/grml-scripts/rev/7f265425dec1e56bcf711c449bfbca7f54f7145a
Fine! Did not know that rsync can do --progress :)
:)
BTW: Are there any generic "progress indicator" scripts or programs on the grml CD? Something to put into a pipe (e. g. between »dd if=/some/disk« and netcat) to see how much data flows through it? Anything from nice bars to just a KB/MB/GB counter would be nice.
For sure:
,---- [ % grml-tips "status line" ] | Use dd with status line: | | # dd if=/dev/ice conv=noerror,notrunc,sync | buffer -S 100k | dd of=/tmp/file `----
regards, -mika-

* Michael Prokop mika@grml.org [20061212 23:15]:
- Michael Schierl schierlm-public@gmx.de [20061212 21:15]:
Michael Prokop schrieb:
BTW: Are there any generic "progress indicator" scripts or programs on the grml CD? Something to put into a pipe (e. g. between »dd if=/some/disk« and netcat) to see how much data flows through it? Anything from nice bars to just a KB/MB/GB counter would be nice.
For sure:
,---- [ % grml-tips "status line" ] | Use dd with status line: | | # dd if=/dev/ice conv=noerror,notrunc,sync | buffer -S 100k | dd of=/tmp/file `----
Oh and of course take a look at dcfldd which is available on grml as well and provides "display a continual status message on stderr" OOTB.
regards, -mika-

Michael Schierl schrieb:
Michael Prokop schrieb:
I've added a script named grml2ram which is based on your script to package grml-scripts:
http://hg.grml.org/grml-scripts/rev/7f265425dec1e56bcf711c449bfbca7f54f7145a
Fine! Did not know that rsync can do --progress :)
BTW: Are there any generic "progress indicator" scripts or programs on the grml CD? Something to put into a pipe (e. g. between »dd if=/some/disk« and netcat) to see how much data flows through it? Anything from nice bars to just a KB/MB/GB counter would be nice.
bar
I found it in the grml repository and since then I'm using it to see the transfer progress of pipes. It's a very good tool!
grml@grml ~ % apt-cache show bar Package: bar Version: 1.10.5 Architecture: i386 Installed-Size: 124 Maintainer: Michael Peek peek@tiem.utk.edu Priority: optional Section: utils Filename: pool/main/b/bar/bar_1.10.5_i386.deb Size: 43628 MD5sum: 2a5c54edadf56115c44ba4b60b5ded23 Description: Show information about a data transfer Bar is a simple tool to process a stream of data and print a display for the user on stderr showing (a) the amount of data passed, (b) the throughput of the data transfer, and, if the total size of the data stream is known, (c) estimated time remaining, percent complete, and a progress bar. . Bar was originally written for the purpose of estimating the amount of time needed to transfer large amounts (many, many gigabytes) of data across a network. (Usually in an SSH/tar pipe.)
grml@grml ~ % apt-cache policy bar bar: Installed: 1.10.5 Candidate: 1.10.5 Version table: *** 1.10.5 0 500 http://deb.grml.org grml-stable/main Packages 100 /var/lib/dpkg/status
Greetings, Matthias Böttcher
Teilnehmer (5)
-
Matthias Böttcher
-
Michael Prokop
-
Michael Schierl
-
Michael Schierl
-
Wernfried Haas