understanding partitioning
Avi Greenbury
lists at avi.co
Sun Oct 30 13:04:24 UTC 2011
Linux Tyro wrote:
> About how really partitioning works, in fact what exactly it is!
Basically, partitioning is a way of partitioning off a hard drive into
separate areas. Much as you might divide up a warehouse into areas to
keep distinct sorts of stock in, you can divide up hard drives in the
same way.
A hard drive is basically a large area of storage, which
allows the computer to set bits of it to values either of 1 or 0. This,
fundamentally, is how the files are stored on the system. But files
have more than just data - they have things like names, and modified
dates and permissions. We therefore tend to use a filesystem on a
drive.
A filesystem basically sets out a standard for the way files are
to be stored on a drive - how the filename is stored and linked to the
file, and how the permissions work. Common filesystems in Windows are
NTFS and FAT, and Linux tends to use ext3 or ext4. The actual mechanics
of how they work isn't particularly important, but the reason that,
say, Windows needs a different partition to Linux us because Windows
assumes NTFS's way of storing permissions and other file data, and
Linux assumes ext's. [0] You would, therefore, put Windows on an NTFS
filesystem in one partition, and Ubuntu on an ext filesystem in another.
> - What are these partitions sda1, 2, 3, ....how to know if ubuntu is
> sda1 or sda2 or what and is it different from /home....?
> - When I installed ubuntu 10.04 LTS, it got installed and that
> partition is sda1/2/3/4/5 ...and upto where does this go...?
In contrast to Window's way of exposing hard drives with drive letters,
Linux lets you 'mount' any drive at any directory. To 'mount' a drive
is to make it available under a directory. If you had a big disk full
of music, for example, you might wish to mount it under the directory
'music' in your home directory, then you just go into that directory to
access the files on the disk.
/dev/ is a directory in which devices are 'kept'. To mount a drive, you
need to specify which device you want mounted (using its /dev address)
and which directory you want it mounted on.
/dev isn't reserved for disk drives, though. Disk drives generally
start /dev/sd nowadays.
/dev/sda is the first drive, /sdv/sdb the second and so on.
The partitons are then themselves denoted by letters:
/dev/sda1 is the first partition on the first drive, /dev/sda4 the
fourth. You cannot actually *do* anything to the drives with these
addresses - if you want to get at the files on them you need to
instruct Linux to mount them first. Fortunately, it probably already
has.
I'm not aware of a graphical way to investigate what's mounted on the
computer, though I'm sure there is one, but you can get an idea if you
open a terminal (ctrl+alt+t) and then enter this text and hit enter:
mount
You will see several virtual drives mounted (ones with lines that don't
start '/dev/') but you should be able to pick out the ones that are
real-life drives. The lines are of the form:
/dev/sda6 on / type ext3 (rw,errors=remount-ro,commit=0)
This is /dev/sda6 (that is, the sixth partition of the first drive)
Mounted on / (that is, the 'root' directory, so it's where my operating
system is)
Of type ext3 (so the filesystem I'm using is ext3)
The bits in the brackets are options for mounting, which are likely to
be different, but are rather boring and irrelevant here anyway,
> -LVM yet another thing, is related with what...? It is (also) a
> partition or what....? It is sda...?
LVM is rather more complicated, at least until you're happy with
partitions and mounting and the like. Unless you've need to know and
use it shortly, it would be beneficial to get quite comfortable with
filesystems, partitions and the like before exploring LVM.
Put simply, though, it provides a means of effectively having
partitions whose sizes can be changed while they're in use - generally
without LVM this is not possible.
> - Mounting a partition means what, what exactly we are going to do
> with that partition after mounting it and before mounting, was it in
> existence?
We speak of mounting drive at directories, and you make the contents
of the drive appear as the contents of the directory. Any previous
contents of that directory still exist, but are inaccessible while the
drive is mounted.
--
Avi
[0] More properly, it assumes whichever you've told it to use, but
Ubuntu uses ext4 by default, so I've assumed you're using that.
More information about the ubuntu-users
mailing list