LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Debian
User Name
Password
Debian This forum is for the discussion of Debian Linux.

Notices


Reply
  Search this Thread
Old 10-18-2006, 12:13 PM   #1
abrand888
LQ Newbie
 
Registered: May 2005
Posts: 11

Rep: Reputation: 0
how can I automate my usb drive to be read/write


Hello,

I am using Knoppix 3.8 live CD. As soon as it loads, it sees my USB external drive, I mount it and configure it to be read/write and when I do any
downloading, I direct it to be saved in my USB drive.

Is there a simple way to make it do it automatically as soon as it boots up ?

I tried Knoppix 5.0 and it wouldn't let me mount and make my USB drive read and write. Is there a way to do in in 5.0 ?

I also plugged in my USB antenna and neither Knoppix 3.8 or 5.0 sees my antenna.

Thanks..

Arthur
 
Old 10-19-2006, 08:15 AM   #2
Dutch Master
Senior Member
 
Registered: Dec 2005
Posts: 1,686

Rep: Reputation: 124Reputation: 124
Yes, you could write a script and put that in the /etc/rc directories. Writing a script isn't that difficult, basically you're telling the kernel to execute the same commands as you would do from the commandline. Basic syntax:
Code:
#!/bin/bash
<command_1><options>
<command_2><options>
....
exit 0
Simple, isn't it? Save it in your home-directory with an appropiate name and make it executable. Then create a sym-link from the /etc/rc directory to your script. The name of that sym-link should be something like
Code:
S<2 digit bootcode>scriptname
The 2 digit bootcode determines when in the boot sequence the script is called. Mind you, you'd have to make sure it doesn't call on services not started yet! So I suggest to have a bootcode of 25 or higher. Keep the scriptname as short but meaningful as possible, preferable max 8 characters. It'll probably work with more characters, but better to play on the safe side.
 
Old 10-19-2006, 12:31 PM   #3
basileus
Member
 
Registered: Nov 2004
Location: Turku, Finland
Distribution: Debian, Ubuntu, Gentoo
Posts: 388

Rep: Reputation: 30
Some versions of Knoppix that I've used mount removable drives read-only by default. Right-clicking on the drive icon and choosing "Remount read-write" (or something) should help.

To make this the default behavior you probably need a persistent home directory where you can save your boot-time settings.
 
Old 10-19-2006, 04:04 PM   #4
abrand888
LQ Newbie
 
Registered: May 2005
Posts: 11

Original Poster
Rep: Reputation: 0
Dutchmaster :

Excuse my ignorance but could you explain in simple english what each line means ?

#!/bin/bash
<command_1><options>
<command_2><options>
....
exit 0

What does each line tell the kernel. Please bear in mind that I am using a live cd so I would like to just go to terminal mode if possible and run a script giving it instructions if possible. Please explain to me in laymans terms what this line means

S<2 digit bootcode>scriptname

and where does one put this line in the script.

Thanks a lot.

Arthur

Basileus :

In 3.8 ver of Knoppix I can change the read to write and did it by mounting and doing actions, but Knoppix 5.0 didn't let me dp that yet. Will try over the weekend again.

Thanks.

Arthur
 
Old 10-19-2006, 06:58 PM   #5
Dutch Master
Senior Member
 
Registered: Dec 2005
Posts: 1,686

Rep: Reputation: 124Reputation: 124
Ok, I kinda overlooked that you're on a Live CD and not familiar with the commandline. That isn't a problem as Basileus already explained the way to do it from your desktop.

You asked what the various lines in my syntax example mean. But, as you're new to this, I'm a bit worried that it might be to much in one go.
Code:
#!/bin/bash
<command_1><options>
<command_2><options>
....
exit 0
The first line tells the kernel that to execute the script properly it needs to use a specific interface with it's syntax. In this case, the interface is named "BASH". There are a few others, but bash is the most widespread in Linux.

The second and third line are basicaly equal. This is an abstract way to tell the reader that (s)he needs to replace that line with the command that needs to be executed, followed by the command's options.

The fourth line is the (my) way to tell the reader to continue with the previous lines as necesary.

The last line tells the kernel that it reached the end of the script and that if it could be executed normaly it should exit with an error status of 0 (as in zero) That is standard behaviour and IMHO a good programmer should always end a script nicely (for the kernel, not me )

Next, you where a bit confused about
Code:
S<2 digit bootcode>scriptname
Again, the way I wrote it tells the understanding reader to replace the part between the < and > with a 2 digit number and the name of the script. It's not used inside the script, it's intended to give the script a name and a place in the sequence of execution by the kernel when booting. Actually, it's a link to the actual script in your home directory.

As I've said, I'm afraid that this might be a bit to much to comprehend in one go for a newbee. So if you don't understand it's not a problem. I too needed time to understand this. Use it as a brief introduction to writing scripts and read it again when you've got to grips with Linux and it's versatility.
 
  


Reply


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
Problem mounting drive read/write abefroman Linux - Software 5 01-31-2006 10:30 PM
nagging problem --sharing USB drive with Windows for read/write 1kyle SUSE / openSUSE 2 09-25-2005 03:35 AM
Cannot mount a USB drive as read/write. icheyne MEPIS 2 06-28-2005 01:48 AM
read & write USB pen drive?? wrangler Linux - Newbie 5 03-08-2005 03:11 PM
USB drive keeps mounting as "read only" I need to write to it. Lossenelin Linux - Hardware 1 02-12-2004 06:49 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Debian

All times are GMT -5. The time now is 02:09 AM.

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