LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 11-05-2008, 02:24 AM   #1
cyberiapost
Member
 
Registered: Dec 2005
Location: 127.0.0.1
Distribution: slackware
Posts: 78

Rep: Reputation: 15
confused a bit about mount


when i use the mount command to mount an hdd to a mount point .. am i mounting the hdd as a whole or the partitions like hdd1 ?



 
Old 11-05-2008, 02:37 AM   #2
i92guboj
Gentoo support team
 
Registered: May 2008
Location: Lucena, Córdoba (Spain)
Distribution: Gentoo
Posts: 4,083

Rep: Reputation: 405Reputation: 405Reputation: 405Reputation: 405Reputation: 405
Quote:
Originally Posted by cyberiapost View Post
when i use the mount command to mount an hdd to a mount point .. am i mounting the hdd as a whole or the partitions like hdd1 ?



It depends on what exactly you are doing.

If we speak about hard disks, then the usual thing is that they will contain partitions, so, you don't mount hdc, but hdc1, hdc2... and so on. You could format the whole disk without partitioning it, something that's not possible in other OSes, then you could mount it instead of mounting single partitions, but you usually don't do that. In linux you can even format a file and mount it as it was a disk.

On the contrary, when we speak about cdroms we mount the whole block device, and not a partition. So, if hdc is a cdrom, then we mount hdc itself, and not hdc1.

It just depends on how did you create the filesystem and that stuff.

Last edited by i92guboj; 11-05-2008 at 02:46 AM.
 
Old 11-05-2008, 03:17 AM   #3
cyberiapost
Member
 
Registered: Dec 2005
Location: 127.0.0.1
Distribution: slackware
Posts: 78

Original Poster
Rep: Reputation: 15
thanks for clearing that up
 
Old 11-05-2008, 10:24 AM   #4
onebuck
Moderator
 
Registered: Jan 2005
Location: Central Florida 20 minutes from Disney World
Distribution: Slackware®
Posts: 13,925
Blog Entries: 44

Rep: Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159
Hi,

Quote:
Originally Posted by i92guboj View Post
It depends on what exactly you are doing.

If we speak about hard disks, then the usual thing is that they will contain partitions, so, you don't mount hdc, but hdc1, hdc2... and so on. You could format the whole disk without partitioning it, something that's not possible in other OSes, then you could mount it instead of mounting single partitions, but you usually don't do that. In linux you can even format a file and mount it as it was a disk.

On the contrary, when we speak about cdroms we mount the whole block device, and not a partition. So, if hdc is a cdrom, then we mount hdc itself, and not hdc1.

It just depends on how did you create the filesystem and that stuff.
Not to get too picky but!

When you allocate all the space on a hdd to a particular filesystem you must first create a partition on that device then create the filesystem of choice by formatting. To the OP, you should look at the complete 'man' pages for the commands.

Code:
excerpt from 'man fdisk';

NAME
       fdisk - Partition table manipulator for Linux

SYNOPSIS
       fdisk [-u] [-b sectorsize] [-C cyls] [-H heads] [-S sects] device

       fdisk -l [-u] [device ...]

       fdisk -s partition ...

       fdisk -v

DESCRIPTION
       Hard  disks can be divided into one or more logical disks called parti-
       tions.  This division is described in the partition table found in sec-
       tor 0 of the disk.

       In the BSD world one talks about `disk slices' and a `disklabel'.

       Linux  needs  at  least one partition, namely for its root file system.
       It can use swap files and/or swap partitions, but the latter  are  more
       efficient. So, usually one will want a second Linux partition dedicatedas swap partition.  On Intel compatible hardware, the BIOS  that  boots
       the  system can often only access the first 1024 cylinders of the disk.
       For this reason people with large disks often create a third partition,
       just  a  few  MB large, typically mounted on /boot, to store the kernel
       image and a few auxiliary files needed at boot time, so as to make sure
       that  this  stuff  is  accessible to the BIOS.  There may be reasons of
       security, ease of administration and backup, or testing,  to  use  more
       than the minimum number of partitions.

       fdisk  (in  the  first form of invocation) is a menu driven program for
       creation and manipulation of partition tables.  It understands DOS type
       partition tables and BSD or SUN type disklabels.

       fdisk  doesn't  understand  GUID  Partition  Table  (GPT) and it is not
       designed for large partitions. In particular case use more advanced GNU
       parted(8).

       The device is usually one of the following:
              /dev/hda
              /dev/hdb
              /dev/sda
              /dev/sdb
Code:
excerpt from 'man mkfs';


NAME
       mkfs - build a Linux file system

SYNOPSIS
       mkfs [ -V ] [ -t fstype ] [ fs-options ] filesys [ blocks ]

DESCRIPTION
       mkfs  is  used to build a Linux file system on a device, usually a hard
       disk partition.  filesys is either the device  name  (e.g.   /dev/hda1,
       /dev/sdb2).   blocks  is  the  number of blocks to be used for the file
       system.

       The exit code returned by mkfs is 0 on success and 1 on failure.

       In actuality, mkfs is simply a front-end for the  various  file  system
       builders (mkfs.fstype) available under Linux.  The file system-specific
       builder is searched for in a number of directories like perhaps  /sbin,
       /sbin/fs,  /sbin/fs.d,  /etc/fs,  /etc  (the precise list is defined at
       compile time but at least contains /sbin and /sbin/fs), and finally  in
       the  directories  listed  in the PATH environment variable.  Please see
       the file system-specific builder manual pages for further details.
 
Old 11-05-2008, 11:19 PM   #5
i92guboj
Gentoo support team
 
Registered: May 2008
Location: Lucena, Córdoba (Spain)
Distribution: Gentoo
Posts: 4,083

Rep: Reputation: 405Reputation: 405Reputation: 405Reputation: 405Reputation: 405
Quote:
Originally Posted by onebuck View Post
When you allocate all the space on a hdd to a particular filesystem you must first create a partition on that device then create the filesystem of choice by formatting.
Yes. Re-read my post. That's what you must do. But you can format the whole device without partitioning it, just like you format any other file without partitioning it to use it later as a loopback filesystem. That's why I said that

Quote:
You could format the whole disk without partitioning it [...] but you usually don't do that
.

To be more explicit, there's nothing stopping you from doing something like "mkfs.ext3 /dev/hda".
 
Old 11-06-2008, 07:12 AM   #6
onebuck
Moderator
 
Registered: Jan 2005
Location: Central Florida 20 minutes from Disney World
Distribution: Slackware®
Posts: 13,925
Blog Entries: 44

Rep: Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159
Hi,

I thought we were speaking about partitioning for the OP. Explaining the reasoning for setting up partitions on devices.
 
Old 11-06-2008, 07:41 AM   #7
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Mint
Posts: 17,809

Rep: Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743
But the point I am seeing is that you do NOT have to set up any partitions.....

Mybe this will help (cyberiapost--are you still with us?):

You don't mount drives or partitions---you mount filesystems. The filesystem can exist on a partition, or it can exist on the whole drive--with no partitions.

The other semanticism* I find useful is to think of "mount" as "connect". When you say "mount /dev/sda2 myfiles", you are connecting the filesystem on /dev/sda1 to the "myfiles" node on the overall filesystem tree.

For the history buffs, note that "mount" comes from the old days when "mounting the filesystem" meant walking thru a bunch of racks, finding a tape, and physically mounting it on the tape drive.



*Yes, I just made up that word.....
 
Old 11-06-2008, 08:59 AM   #8
i92guboj
Gentoo support team
 
Registered: May 2008
Location: Lucena, Córdoba (Spain)
Distribution: Gentoo
Posts: 4,083

Rep: Reputation: 405Reputation: 405Reputation: 405Reputation: 405Reputation: 405
Quote:
Originally Posted by pixellany View Post
But the point I am seeing is that you do NOT have to set up any partitions.....

Mybe this will help (cyberiapost--are you still with us?):

You don't mount drives or partitions---you mount filesystems.
That's the whole point that I wanted to make clear, though I probably failed at it. You said it all in one short and perfect sentence. The whole point I wanted to make clear is that it doesn't matter if it's a hard disk (hda), a partition (hda1), a cdrom (hda, scd0, or whatever) or a file on your disk (myimagefile.img). As long as it contains a file system it can be mounted.

If you know and understand that, then everything else becomes crystal clear, and you don't need to ask things like "do I mount hda or hda1?".
 
  


Reply



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
64 bit linux - confused about 32 bit apps babysnake Linux - Software 2 08-21-2006 01:43 AM
kinda confused 64 bit?? N_A_J_M Linux - General 2 05-04-2006 10:58 AM
I am a bit confused. Igor007 Programming 2 08-25-2005 07:07 PM
heh....im a bit confused....need help badly!! Sticktendo Linux - Newbie 9 12-27-2004 07:29 PM
Well....I'm a bit...confused Bigun Linux - General 5 06-25-2003 12:06 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 09:06 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