Download your favorite Linux distribution at LQ ISO.
Go Back > Forums > Non-*NIX Forums > General
User Name
General This forum is for non-technical general discussion which can include both Linux and non-Linux topics. Have fun!


  Search this Thread
Old 03-16-2008, 10:01 PM   #1
LQ Newbie
Registered: Jul 2006
Posts: 14

Rep: Reputation: 0
script to ask for cd/dvd media change

Hi there

I have done this:
ntfsclone --save-image -o - /dev/hda1 | gzip -c | split -b 2000m - backup.img.gz.
So far all fit into one single dvd. Now the unevitable occured: it does not even fit on a DL dvd anymore. So in order to restore
cat backup.img.gz.?? | gzip -d | ntfsclone --restore-image --overwrite /dev/hda1 -
I would have to change the dvd's. How can I ask the user to change the disk from inside a bash script?

greets chris
Old 03-16-2008, 10:36 PM   #2
LQ Guru
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 678Reputation: 678Reputation: 678Reputation: 678Reputation: 678Reputation: 678
And how do you prevent failure if the wrong disk is inserted? I will have a problem where I'll eject the disk and it will pop back in again.

I think part of the solution is to use a fifo device instead of a pipe and have the cat.backup.img.gz.* part in a loop on one statement, and the ntfs-clone command either on another line or in a subshell on the same line. You would redirect the output of cat into the fifo device. You would take the input of ntfsclone from the fifo device.

Now you can have a text file catalog containing the names of the disc and the slice names on each disk, and when a different disc is called for call "eject" to eject the disc and the dialog to alert the user or to solicit input.

The Advanced Bash Scripting Guide (abs-from the website may have some good examples of using the dialog family of programs (dialog, Xdialog, gdialog, kdialog) and using named fifo pipes.
Old 03-19-2008, 12:18 PM   #3
Registered: Oct 2005
Location: Annapolis
Distribution: Ubuntu
Posts: 278

Rep: Reputation: 41
Far Out

Whoa Dude! Excellent answer, I'm now smarter than when I woke up this morning (admittedly, not a difficult thing to do).


media, script

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
cannot boot dvd from dvd + media and rom cjae Linux - Newbie 5 12-30-2009 10:32 AM
change dvd read speed when copying dvd OMT Slackware 3 07-22-2007 03:01 PM
How can I change cdrom1 to dvd. REDhat9, lite-on LTD-163D dvd drive theonlydrew Linux - Hardware 3 01-26-2006 05:54 PM
how do i change default media player rosscopeeko Mandriva 2 04-12-2004 08:45 AM
How to burn a DVD-9 on a DVD-5 media yktang Linux - Software 1 07-15-2003 04:50 AM > Forums > Non-*NIX Forums > General

All times are GMT -5. The time now is 10:28 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration