[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Free space remaining on DVD



I'm using dvd+rw-tools (5.21.4.10.8) along with cdrtools (2.01.01) on a
Gentoo Linux (2.6.12) box.  My goal is to make periodic backups of my
personal server onto DVD+RW discs.

Since each backup tarball is around 600Meg, I can fit 6-8 backups on a
single DVD.  So once my bash script creates the tarball, it runs
something like:

  /usr/bin/growisofs -M /dev/dvd -R -J -iso-level 3 -speed=2
  -use-the-force-luke=tty -graft-points /2005-09-09=/tmp/backup/2005-09-09

However, if the DVD doesn't have enough room left, I get this expected
error message:

  :-( /dev/dvd: 242112 blocks are free, 281816 to be written
  :-( write failed: No space left on device

What I'd LIKE to do is know in advance how much space is left on the
DVD so I can decide whether I can continue to append to it (growisofs
-R) or whether I need to blank the DVD and start over (growisofs -Z).

How can I find out how much space is left on the DVD?  I suppose I
could mount it, run "du -sk /mnt/cdrom" or "df -k", unmount the disc,
and do the math to figure out whether (tarball size) + (currently used
space) <= (total DVD space).  But that seems a bit clunky, especially
if I'm just making my best guess as to the DVD's capacity (4.38 Gig?)

Is there an easier way to find out from the system EXACTLY how much
free space remains on the DVD, so I can dynamically generate the
correctly growisofs command from my backup script?

Thanks to anyone who can help.



Reply to: