LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   confused a bit about mount (https://www.linuxquestions.org/questions/linux-newbie-8/confused-a-bit-about-mount-681222/)

cyberiapost 11-05-2008 02:24 AM

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 ?



:confused:

i92guboj 11-05-2008 02:37 AM

Quote:

Originally Posted by cyberiapost (Post 3332167)
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 ?



:confused:

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.

cyberiapost 11-05-2008 03:17 AM

thanks for clearing that up :)

onebuck 11-05-2008 10:24 AM

Hi,

Quote:

Originally Posted by i92guboj (Post 3332177)
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.


i92guboj 11-05-2008 11:19 PM

Quote:

Originally Posted by onebuck (Post 3332511)
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".

onebuck 11-06-2008 07:12 AM

Hi,

I thought we were speaking about partitioning for the OP. Explaining the reasoning for setting up partitions on devices.

pixellany 11-06-2008 07:41 AM

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.....

i92guboj 11-06-2008 08:59 AM

Quote:

Originally Posted by pixellany (Post 3333394)
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?".


All times are GMT -5. The time now is 05:18 AM.