Linux Help
guides forums blogs
Home Desktops Distributions ISO Images Logos Newbies Reviews Software Support & Resources Linuxhelp Wiki

Welcome Guest ( Log In | Register )



Advanced DNS Management
New ZoneEdit. New Managment.

FREE DNS Is Back

Sign Up Now
> How to mount a drive or partition
Corey
post Jul 9 2003, 09:06 AM
Post #1


Its GNU/Linuxhelp.net
*******

Group: Admin
Posts: 1,254
Joined: 21-September 02
From: St John's, Newfoundland, Canada
Member No.: 3



When coming from the Windows world, the idea of "mounting" a drive seems a bit strange, afterall, your used to popping in a cd and clicking on the icon in My Computer to open it up. You're used to Windows "just doing it" when it came to showing new partitions in the My Computer tab.

Think of "mounting" as inserting a filesystem into your current system. The beauty of mounting is that everything is in a nice neat structure, everything is a part of the filesystem and makes it easier to maintain.

You can mount anything from a cdrom to a hard drive. I will cover these 2 different mediums.

First thing, we need a mount point. Historically, Linux users (and distributions) use the directory /mnt to hold all the mount points. Mount points like /mnt/cdrom and /mnt/floppy were common. However, recently, different distributions are changing this "assumed" standard. SuSE puts cdroms and floppys in /media and windows partitions in /windows. While Debian uses /floppy and /cdrom . While all of these are fine for their uses, i'm still a fan of /mnt . So, here we go:

Mounting a CD-Rom

First off, create your mount point (note, your distribution may already have a mount point, this is just an example):
[quote]tourettes@linuxhelp.ca:$ mkdir /mnt/cdrom[/quote]

Make sure you have a cd in the drive, and it is a Data cd (you cannot mount audio cds). And mount it with the following:
[quote]tourettes@linuxhelp.ca:$ mount -t iso9660 /dev/cdrom /mnt/cdrom[/quote]

The above is a little tricky, especially the "/dev/cdrom" part. /dev/cdrom is usually a symlink to the appropriate cdrom device. If your system has more then one cdroms or a scsi device, this could varry. This goes beyond the scope of this PAQ, so you will have to determine which cdrom device is correct.

When you are finished with the CD, be sure to Un-Mount it because you cannot eject the cd until it's un-mounted.

[quote]tourettes@linuxhelp.ca:$ umount /mnt/cdrom[/quote]

Hard Drive (Partition)

Hard drives and partitions can be a little more trickier then cdroms due to the many many different types of filesystems they could contain. Notice above in the mounting of the cdrom, I have one paramater "-t iso9660"? What this is doign is stating the filesystem of what is being mounted. This almost always needs to be stated so mount can mount it properly. The man page for mount (man mount) gives a list of every filesystem it supports as well as additional options to pass to mount. Some basic filesystems are:

ext2 - The Linux ext2 filesystem, which is currently the standard
ext3 - The Linux journalled filesystem
reiserfs - A fast journalled filesystem for linux
ntfs - The Windows NT filesystem
vfat - The Windows FAT16/FAT32 filesystems.

So, say you're dual-booting your linux system with Windows 98 and you want to have access to your files on that partition. First off, you would make the mount point:

[quote]tourettes@linuxhelp.ca:$ mkdir /mnt/win98[/quote]

Now, mount the partition to that mountpoint:

[quote]tourettes@linuxhelp.ca:$ mount -t vfat /dev/hda1 /mnt/win98[/quote]

This assumes that your Windows partition is located in /dev/hda1 , this can be easily figured out with the "fdisk -l" command to show you which one is the Windows system. Now, you are able to browse to that directory, read and write to the windows directory.

Note: The NTFS filesystem can only be mounted as read-only. So, if you mount this, you will only be able to read from it and not write any data. There are ways to mount it as read/write, but it is very dangerous and should not be done by anyone.

There is also a file located in /etc/fstab which automatically mounts your partitions on bootup. So, if you wanted your Windows partition to automatically be mounted on bootup, you would need to add it to this file. Please refer to the man page for instructions on how to do this.


--------------------
Corey Quilliam
(former) Linuxhelp.ca Administrator
cquilliam-AT-gmail-dot-com

Want to help out Linuxhelp.net? Check out our Linuxhelp Wiki and see if there are some articles you would like to submit!!

--
Ubuntu 8.04 64-bit - Work Laptop (HP-Compaq NC6400 Core2)
Kubuntu 8.04 64-bit - Desktop (HP m8120n QuadCore)
Ubuntu 6.04 - Server (I'm not upgrading this baby until support runs out in 2012) (Some old POS dell)
Go to the top of the page
 
+Quote Post
 
Start new topic
Replies
hughesjr
post Nov 15 2003, 11:24 AM
Post #2


Its GNU/Linuxhelp.net
*******

Group: Admin
Posts: 3,433
Joined: 25-July 03
From: Corpus Chrsiti, TX, USA
Member No.: 1,151



Mounting a Samba share is very similar (after installing the packages smbfs and smbclient).

The command is:

QUOTE
mount -t smbfs -o username=user,password=user_password //win-server-name/sharename /mountdir


-t smbfs is the filesystem type (smbfs).

-o username=user,password=user_password is a username and password (on the sharing computer) of a user who can access the share.

//win-server-name/sharename is the sharing computer's name and share name you created on the sharing computer.

/mountdir is where you want to mount the folders into your linux system.

(the packages needed are different for different linux distros .. for debain you need smbfs, smbclient ... for redhat/suse/fedora/mandrake use need samba-client, samba-common)


--------------------
Johnny Hughes
hughesjr@linuxhelp.net
Enterprise Alternatives: CentOS, WhiteBoxEL
Favorite Workstation Distros (in order): CentOS, Gentoo, Debian Sarge, Ubuntu, Mandrake, FedoraCore, Slackware, SUSE
Favorite Server Distros (in order): CentOS, WhiteBoxEL, Debian Sarge, Slackware, Mandrake, FedoraCore, Gentoo, SUSE
Go to the top of the page
 
+Quote Post

Posts in this topic


Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



RSS Lo-Fi Version Time is now: 24th November 2017 - 01:36 PM