You are not logged in.

#1 2009-03-05 00:11:06

ku
Member
Registered: 2008-03-20
Posts: 23

HOWTO and script: create and burn an UDF image with 4+GB files

Most people think, creating UDF images with files bigger than 4GB or even 1GB is impossible, however it's not true! You just need udftools. Also you need to load loop and udf modules. There's a good howto by grigio, I also created an (admitably pretty poor) script to do it automatically, since grigio's howto doesn't include real dvd sizes:

UDFPATH=$HOME
echo -e "By default the udf image will be placed into your home directory. \n Do you want to enter an alternative one? (Enter y or n)"
read yesorno
if [ $yesorno == y ]; then
  echo "Please enter the directory you want to use: "
  read UDFPATH
  if [ -d $UDFPATH ]; then
    echo "Using $UDFPATH"
  else
    echo "Creating $UDFPATH" && mkdir -v $UDFPATH
  fi
fi
if [ $yesorno == n ]; then
  echo "Using default directory"
fi
if [ $yesorno != y -a $yesorno != n ]; then
  echo "Incorrect entry, aborting..." && exit 0
fi
if [ -e $UDFPATH/udf.iso ]; then 
  mv $UDFPATH/udf.iso $UDFPATH/udf.iso.bak-`date +%y.%m.%d-%H.%M` && echo "udf.iso already exists! Backing up..."
fi
 
echo -e "Please enter your type of disk: dvd5p, dvd5m, dvd9p or dvd9m:\n(5/9 stand for normal/double layer disk and p/m for +/-)"
read type
if [ $type == dvd5p ]; then
  echo "Creating a 4,7 GB DVD+R image..."
  dd if=/dev/zero of=$UDFPATH/udf.iso bs=1024 count=4590208
fi
if [ $type == dvd5m ]; then
  echo "Creating a 4,7 GB DVD-R image..."
  dd if=/dev/zero of=$UDFPATH/udf.iso bs=1024 count=4596992
fi
if [ $type == dvd9p ]; then
  echo "Creating a 8,5 GB DVD+R image..."
  dd if=/dev/zero of=$UDFPATH/udf.iso bs=1024 count=8347648
fi
if [ $type == dvd9m ]; then
  echo "Creating a 8,5 GB DVD-R image..."
  dd if=/dev/zero of=$UDFPATH/udf.iso bs=1024 count=8343424
fi
if [ $type != dvd5p -a $type != dvd5m -a $type != dvd9p -a $type != dvd9m -a $type != cheat ]; then
  echo "Wrong type entered, aborting..." && exit 0
fi

mkudffs $UDFPATH/udf.iso
echo -e "UDF image created in $UDFPATH/udf.iso. Want to mount it right now? (Make sure udf and loop modules are loaded)"
read yesorno
if [ $yesorno == y ]; then
  echo "Please enter the directory you want to use for mounting: "
  read MOUNTPATH
  if [ $UDFPATH = $MOUNTPATH ]; then
      echo "You can't mount the image to the directory it exists in!" && exit 0
      echo -e " Mount it yourself with 'sudo mount -o loop,user,uid=`id -u` -t udf $UDFPATH/udf.iso targetdir\'"
      echo " Afterwards copy your files, unmount the image and burn the dvd."
      echo -e " For burning you may just use 'cdrecord -eject -dao -dev=/dev/sr0 $UDFPATH/udf.iso'\n (the path to your DVD burner may vary!)"
  fi
  if [ -d $MOUNTPATH ]; then
    echo "Using $MOUNTPATH"
    USERID=`id -u`
    sudo mount -o loop,user,uid=$USERID -t udf $UDFPATH/udf.iso $MOUNTPATH
    echo "Copy your files, umount the image and burn the dvd."
    echo -e "For burning you may just use 'cdrecord -eject -dao -dev=/dev/sr0 $UDFPATH/udf.iso'\n(the path to your DVD burner may also vary)";
  else
    echo "Creating $MOUNTPATH..." && mkdir -v $MOUNTPATH
      USERID=`id -u`
      sudo mount -o loop,user,uid=$USERID -t udf $UDFPATH/udf.iso $MOUNTPATH
      echo "Copy your files, umount the image and burn the dvd."
      echo -e "For burning you may just use 'cdrecord -eject -dao -dev=/dev/sr0 $UDFPATH/udf.iso'\n(the path to your DVD burner may also vary)";
  fi
fi
if [ $yesorno == n ]; then
  echo -e "All right, then mount it yourself with 'sudo mount -o loop,user,uid=`id -u` -t udf $UDFPATH/udf.iso targetdir'\nAfterwards copy your files, unmount the image and burn the dvd."
  echo -e "For burning you may just use 'cdrecord -eject -dao -dev=/dev/sr0 $UDFPATH/udf.iso'\n(the path to your DVD burner may also vary)"
fi
if [ $yesorno != y -a $yesorno != n ]; then
  echo "Incorrect entry, aborting..."
  echo -e " Mount it yourself with 'sudo mount -o loop,user,uid=`id -u` -t udf $UDFPATH/udf.iso targetdir\'"
  echo " Afterwards copy your files, unmount the image and burn the dvd."
  echo -e " For burning you may just use 'cdrecord -eject -dao -dev=/dev/sr0 $UDFPATH/udf.iso'\n (the path to your DVD burner may vary!)"
  exit 0
fi

EDIT: Some major mistakes solved.

Last edited by ku (2009-04-23 19:02:41)

Offline

Board footer

Powered by FluxBB