Clan x86

Technical (Development, Security, etc.) => Unix / Linux Discussion => Topic started by: Joe on September 21, 2005, 04:44:05 PM

Title: Using CD drives?
Post by: Joe on September 21, 2005, 04:44:05 PM
Alright, I have Slackware. I have two CD-ROM drives. I'm probably going to be using KDE instead of WMaker. Anyhow, how would I mount D: to /mnt/cd1 and E: to /mnt/cd2? Or would it be /mnt/cda1 and /mnt/cdb1, being two totally different drives?

Offtopic:
Also, Linux has an autoexec.bat-type shellscript to start programs on kernel startup, right? Where is this, if so?

Note: This post is set in the future. I stil don't have Slackware.
Title: Re: Using CD drives?
Post by: iago on September 21, 2005, 05:03:01 PM
Your cd drives, assuming they're ide, will be in /dev/hda, hdb, hdc, or hdd.  To figure out which one is which, do "dmesg | grep hda", "dmesg | grep hdb", etc.  That should give you the information you need. 

In Linux, the "kernel startup" is the first couple seconds.  All the rest is programs being run and modules being loaded.  Pretty much everything you see while it's booting is programs/shellscripts outputting their stuff.  Depending on what you want to do, you want your stuff to run at different points during startup, which you can check out in the /etc/rc.d/ folder.  If you view each file in there (especially rc.0, rc.1, etc.) they'll tell you what happens when. 

The easiest way is to put your programs in /etc/rc.d/rc.local.  As it says in its comment, rc.local is the last script to be run on boot. 
Title: Re: Using CD drives?
Post by: Sidoh on September 21, 2005, 05:18:16 PM
Interestingly enough, the 250GB HDD I ordered for my server just came in today.  I didn't even have to ask for help -- it was already here!
Title: Re: Using CD drives?
Post by: Newby on September 21, 2005, 05:18:35 PM
/dev/cdrom is linked to your main CDRom most of the time.

newby@impaler:~$ ls -l /dev/cdrom
lrwxrwxrwx  1 root root 8 2005-07-03 15:21 /dev/cdrom -> /dev/hda
Title: Re: Using CD drives?
Post by: Joe on September 21, 2005, 05:30:20 PM
Alright, slick! Also, how well does this handle removing+inserting different CDs?

/dev/hda1 = C:\
/dev/hdb1 = D;\
/dev/hdc1 = E:\

Setup:
*login as root*
cd /mnt
mkdir cd1
mkdir cd2

On box start:
mount /dev/hdb1 /mnt/cd1
mount /dev/hdc1 /mnt/cd2

Right?
Title: Re: Using CD drives?
Post by: Newby on September 21, 2005, 05:32:58 PM
No.

/dev/hda = CD-Rom for me ("D:")
/dev/hdc = CD/DVD-Rom for me ("E:")
/dev/sda = Hard-drive
/dev/sdb = Hard-drive

/dev/sda1 = Windows partition ("C:")
/dev/sda2 = Linux partition (/)
/dev/sdb1 = Windows Partition ("S:")

Again, it will differ on your system.

Most of the directories come premade with your Slackware installation. I made dvdrom for myself, but cdrom was already there.

newby@impaler:~$ ls /mnt
cdrom/   external/  hd/    old-drive/   windows/
dvdrom/  floppy/    ipod/  thumbdrive/

/etc/fstab can link some of the drives to a specific mount point if you wish.
newby@impaler:~$ cat /etc/fstab | grep "cdrom"
/dev/cdrom       /mnt/cdrom       iso9660     noauto,owner,ro  0   0

You really don't want to mount a drive on boot. That's just retarded.

Mount them when you stick a CD in. Unmount (umount) them when you don't.

See, Joe, this is why you weren't a moderator of this board. This is really just a basic of *nix. As much as you may be relatively knowledged in *nix, you aren't totally knowledged enough to moderate issues revolving around it. You are all knowledge, hardly any experience. :)
Title: Re: Using CD drives?
Post by: Sidoh on September 21, 2005, 06:27:06 PM
root@tehserver:~# dmesg | grep hdb
    ide0: BM-DMA at 0xe000-0xe007, BIOS settings: hda:DMA, hdb:DMA
hdb: WDC WD2500JB-00GVA0, ATA DISK drive
hdb: attached ide-disk driver.
hdb: host protected area => 1
hdb: 488397168 sectors (250059 MB) w/8192KiB Cache, CHS=30401/255/63, UDMA(100)
hdb: unknown partition table


Ok, so that's the harddrive.  Now what do I do to access it?
Title: Re: Using CD drives?
Post by: Ergot on September 21, 2005, 07:09:23 PM
I'm guessing you need to partition it...
cfdisk /dev/hdb/

Then mount it
mount /dev/hdb1 /mnt/location
mount /dev/hdb2 /mnt/location2
etc.

/me laughs at Joe. ^^
Title: Re: Using CD drives?
Post by: Newby on September 21, 2005, 07:19:08 PM
Don't forget to make a file system on the partitions!
Title: Re: Using CD drives?
Post by: Sidoh on September 21, 2005, 07:27:35 PM
How? =p
Title: Re: Using CD drives?
Post by: Newby on September 21, 2005, 07:32:15 PM
If I recall correctly, mkfs.

(type man mkfs for more info)
Title: Re: Using CD drives?
Post by: Sidoh on September 21, 2005, 07:45:22 PM
Thanks, Newby!

In case anyone's interested:


root@tehserver:~# mkfs.ext2 /dev/hdb1
mke2fs 1.35 (28-Feb-2004)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
30539776 inodes, 61049000 blocks
3052450 blocks (5.00%) reserved for the super user
First data block=0
1864 block groups
32768 blocks per group, 32768 fragments per group
16384 inodes per group
Superblock backups stored on blocks:
        32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
        4096000, 7962624, 11239424, 20480000, 23887872

Writing inode tables: done                           
Writing superblocks and filesystem accounting information: done

This filesystem will be automatically checked every 37 mounts or
180 days, whichever comes first.  Use tune2fs -c or -i to override.
root@tehserver:~#
Title: Re: Using CD drives?
Post by: Sidoh on September 21, 2005, 07:51:56 PM
Another problem.  Maybe I'm stupid?

root@tehserver:~# mount /dev/hdb1 /mnt/hdb1
mount: mount point /mnt/hdb1 does not exist
Title: Re: Using CD drives?
Post by: Ergot on September 21, 2005, 08:09:25 PM
mkdir /mnt/hdb1

ext2 and not ext3 :S?
Title: Re: Using CD drives?
Post by: Newby on September 21, 2005, 08:43:01 PM
You should do ext3. It's journaling!
Title: Re: Using CD drives?
Post by: Sidoh on September 21, 2005, 08:56:24 PM
Quote from: Newby on September 21, 2005, 08:43:01 PM
You should do ext3. It's journaling!
Someone told me to do ext2.  I can't remember who, but I suppose I'll make it ext3 instead ;p
Title: Re: Using CD drives?
Post by: Krazed on September 21, 2005, 09:42:24 PM
Quote from: Sidoh on September 21, 2005, 08:56:24 PM
Quote from: Newby on September 21, 2005, 08:43:01 PM
You should do ext3. It's journaling!
Someone told me to do ext2.  I can't remember who, but I suppose I'll make it ext3 instead ;p

Well, AFAIK ext3 is newer, and therefore better. Also, about the mount. The directory you're mounting something to always needs to already exist.

So just mkdir, like someone said, and then mount.
Title: Re: Using CD drives?
Post by: iago on September 23, 2005, 12:18:11 AM
Quote from: Joe[e2] on September 21, 2005, 05:30:20 PM
Alright, slick! Also, how well does this handle removing+inserting different CDs?

/dev/hda1 = C:\
/dev/hdb1 = D;\
/dev/hdc1 = E:\

Setup:
*login as root*
cd /mnt
mkdir cd1
mkdir cd2

On box start:
mount /dev/hdb1 /mnt/cd1
mount /dev/hdc1 /mnt/cd2

Right?
You can only mount a drive if it has a cd in it already.  To change the cd, you have to umount it, change the disk, and mount it again.  There's automated ways of doing it, auto-mounter I think, and some Window Managers do it for you (I had a WindowMaker applet that I just had to click to mount/umount my drives). 

Quote from: Krazed on September 21, 2005, 09:42:24 PM
ext3 is newer, and therefore better.
Don't be fooled by that trick.  Note: make is from the late 80's.  And ReiserFS is newer than ext3, but worse, I'm told.  So yeah. Everything else in this thread is good though :P