Estimating left space on a CD...

Andrea Giuliano a.giuliano at iccu.sbn.it
Fri Aug 27 12:23:37 UTC 2004


On Fri, August 27, 2004 13:09, Lewi Kristianto said:
>
> --- Andrea Giuliano <a.giuliano at iccu.sbn.it> wrote:
>
>> Hi,
>> I'm writing a BASH script to do simple backups on a
>> CD-RW, but I can't
>> find a way to know how much space is left on the
>> medium.
>> A trivial solution could be mounting the medium and
>> use "du -sk" on it,
>> but the disadvantage of this method is that the
>> result would just be the
>> total length of the original files, while the ISO
>> images are usually
>> slightly longer. The result is an underestimated
>> value.
> just an idea, while backing up files to cd
> read manual mkisofs in "--print-size" section
>
>> Any hints?
>> Best regards.
>> ----
>> Andrea Giuliano, Ph. D.
>> ICCU - Istituto Centrale per il Catalogo Unico
>> Viale Castro Pretorio 105, Rome - ITALY
>> Tel. +39064989509, Fax +39064059302
>> --
>> fedora-list mailing list
>> fedora-list at redhat.com
>> To unsubscribe:
>> http://www.redhat.com/mailman/listinfo/fedora-list
>
>
>
>
> _______________________________
> Do you Yahoo!?
> Win 1 of 4,000 free domain names from Yahoo! Enter now.
> http://promotions.yahoo.com/goldrush
>

Already done.

The mkisofs -print-size option only tries to calculate the size of the
resulting ISO image, but  doesn't deal with the left space on the device.
Also, since I use the same medium for several consecutive backups, multi
session mode is needed, so cdrecord must be used in TAO mode. In this
mode, the -print-size option is not needed, because there is no need to
tell cdrecord how long the track will be. You just have to tell mkisofs
where the last session ends (cdrecord -msinfo gives you the boundaries of
the last session, the latter being the value you must use for the mkisofs
-C option).

Maybe I didn't make the point clear, sorry. I meant I need just a way to
know how much space is currently available on a CD.

I even didn't find how to know exactly the declared size of the medium
automatically. Cleary, I can just read the label on the cover (at present
I'm using 650Mb CD), but that's not the most cool solution...

The value issue by cdrecord -msinfo is not sufficient, if you don't know
the total size of the medium.

Anyway, many thanks for you suggestion.

----
Andrea Giuliano, Ph. D.
ICCU - Istituto Centrale per il Catalogo Unico
Viale Castro Pretorio 105, Rome - ITALY
Tel. +39064989509, Fax +39064059302





More information about the fedora-list mailing list