Partition On Linux Suse
Partition On Linux Suse
Partition On Linux Suse
Support
Community
Development
Navigation
Project
Distribution
Search
Sign up | Login
Support
Contact
Site map
Contents
Help
Wiki
[hide]
1 Situation
2 Procedure
2.1 Disk
Create a Page
Change a Page
Find a Page
Tools
2.8 Tools
Related changes
Special pages
3 Links
Situation
Sponsors
When it comes to installing openSUSE or to adding/removing of disks to an existing system, people start talking about
mounting and umounting, and about filesystems and partitions. Some people have little real idea what all these words
mean in a Unix/Linux environment which means that discussing problems in this area is full of potential
misunderstandings.
In other languages
Espaol
Many people do have some knowledge based on familiarity with other Operating Systems. That increases the possibility
of confusion.
Procedure
The real procedure to cope with this situation is to spend some time in reading some documentation. This SDB hopes to
be a primer and a starting point for further reading.
All examples shown below were made by the superuser (root).
Disk
In this document, the word disk will be used as a generic term for anything that is seen by the system as a disk drive,
whether it is a flash device that looks like a disk, an optical drive or a 'real' hard disk, or even a combination of several
devices.
Because newer types of mass storage devices present themselves to the system as disks, they fall into this category.
The systems can not see if a disk is inside the system enclosure, beside it, on a table, or on another shelf, so there is
no difference between what some people call internal and external disks.
Disks are normally supplied preformatted by the manufacurer. That means that damaged tracks are marked and
replacements used, sector numbers are written. This is done to interface with the controler hard-/firmware. This type of
formatting is also known as low-level formatting.
(Disk) Partitions.
Unix systems always have had the possibility of assembling a storage sub-system from several partitions. These can be
partitions spread across several physical devices, or can be multiple partitions on one physical device. *Every disk must
have at least one partition, but often there are more. We will limit ourselves here to the partitioning as done on disks in a
PC environment.
(This is not exactly true. Anything over 2TB can not be partitioned as one big partition. You can actually format a
large drive IE: 4tb drive as a full 4tb by simply formatting it with NO partition)
In the beginning, when disks had little space, there was the idea that four partitions would be enough for all possible
usage (which it was not). The data about the partioning is written in the partition table. It is on a special place on the disk
and the BIOS knows all about it.
When it became very apparent that four partitions was not going to be sufficient, a backward-compatible solution was
found: make one of the four a special partition, which can hold more partitions. Newer BIOSes (nowadays all BIOSes)
converted by W eb2PDFConvert.com
Id System
c W95 FAT32 (LBA)
7
f
82
83
83
HPFS/NTFS
W95 Ext'd (LBA)
Linux swap / Solaris
Linux
Linux
beneden:~ #
Partition naming
In the partition table partitions are simply numbered as we saw above.
A special warning here about GRUB. Grub has its own naming/numbering schema and the most important thing to know
is that GRUB starts all disk and partition counting at 0 and not at 1!
When the Linux system starts, it scans the hardware and when it finds disks and partitions it gives them names. These
names are to be found as the names of the device special files in /dev/. Disk will have names like hda, hdb, hdc, ... or
sda, sdb, sdc, ... and partitions of hda will be hda1, hda2, ... and those of sda will be sda1, sda2, ... where the number is
the partition number.
What are these device special files? A special type of file that is associated with hardware. I/O to the hardware is done
by reading from or writing to this file. This is the file metaphor in Unix/Linux. There are two types of these files: character
device special file and block device special file. For disks we do I/O in blocks. Of course this is too long to pronounce
so most people talk about device files. Normally they are created in the /dev/ directory (nowadays dynamically by udev).
Here is what they look like when you list them:
boven:/dev
brw-r----brw-r----brw-r----brw-r----boven:/dev
#
1
1
1
1
#
ls -l sda*
root disk 8,
root disk 8,
root disk 8,
root disk 8,
0
1
2
3
Apr
Apr
Apr
Apr
27
27
27
27
09:45
09:45
09:45
09:45
sda
sda1
sda2
sda3
Most things will be familiar to you. The b indicates a block device special file. Normal users are not allowed to read/write
direct from/to the disk, otherwise all security would be futile. The number 8 (called the major number) is the number the
kernel uses internally for the driver that works with these devices (so it will not send tape commands to disks) and the 0
3 (the minor number) tell them apart from each other inside that driver.
Until recently these /dev/sdb2, etc. were used to mount the partitions and when you give the command mount (shows
what is mounted) you will see them used.
boven:~ # mount
/dev/sda2 on / type ext3 (rw,acl,user_xattr)
/dev/sda3 on /home type ext3 (rw)
...
boven:~ #
This is based on the fact that on every boot the system finds the disks in the same sequence. If this were not to occur,
sda and sdb may be exchanged and the wrong partitions mounted (and the user become very confused)! This can
happen not only at boot, but when a disk is connected to a running system it will get the 'next' name (e.g. sdc). So, for
example, adding an external USB drive to a system, is not guaranteed to get the same mount point every time, which is
converted by W eb2PDFConvert.com
inconvenient.
To abolish this confusion, we would need there to be a unique identifier for the disk. And there is. There are even more.
Look at /dev/disk/. There are several directories there:
boven:~ # ls
total 0
drwxr-xr-x 2
drwxr-xr-x 2
drwxr-xr-x 2
drwxr-xr-x 2
boven:~ #
-l /dev/disk
root
root
root
root
root
root
root
root
360
100
220
80
Jul
Jul
Jul
Jul
5
5
5
5
2008
2008
2008
2008
by-id
by-label
by-path
by-uuid
Look inside these directories. Every one of them has some or all of the partitions, identified in a different way. And each
of these files is not a device special file, but a link to a device special files that we saw earlier. When you look in
/etc/fstab:
boven:~ # cat /etc/fstab
/dev/disk/by-id/scsi-SATA_Hitachi_HDT7250_VFJ201R23XUEXW-part2 /
1 1
/dev/disk/by-id/scsi-SATA_Hitachi_HDT7250_VFJ201R23XUEXW-part3 /home
1 2
/dev/disk/by-id/scsi-SATA_Hitachi_HDT7250_VFJ201R23XUEXW-part1 swap
0 0
...
boven:~ #
ext3
acl,user_xattr
ext3
defaults
swap
defaults
You will see that openSUSE nowadays uses the /dev/disk/by-id/ names to see that the correct partitions are mounted:
boven:~ # ls
lrwxrwxrwx 1
lrwxrwxrwx 1
lrwxrwxrwx 1
lrwxrwxrwx 1
...
boven:~ #
-l /dev/disk/by-id
root root 9 Jul 5
root root 10 Jul 5
root root 10 Jul 5
root root 10 Jul 5
2008
2008
2008
2008
will now show the contents belonging to the mounted fs. When the fs is not mounted, the same ls will show the file
The-fs-is-not-mounted.
Filesystems Hierarchy
converted by W eb2PDFConvert.com
There is a standard organisation for the filesystems on Linux (see reference Linux Filesystem Hierarchy), but this can be
extended and manipulated.
A lot of mounting is done high in the hierarchy. e.g. On the highest level there can (and must) only be one:
(this is mounted readonly very early in the startup sequence, otherwise no tools would be available, not even mount,
and later it is re-mounted read/write)
/
/tmp
/bin
(NO, do not try this one, /sbin/ contains those things like mount needed at system startup before the rest of
the mounting is done!)
/sbin
Further down:
/mnt/...
/media/...
(A partition for this user only. When it is full he is on his own. Let him
signal from udevd. It uses /media/. It mounts everything there. It has its administration there. This is not configurable.
When a the partition to be mounted has a label (e.g. Backup), it will use that label and will mount at /media/Backup/. When
there is no label it will mount using the device type as a name and thus mount at /media/cdrom/ or /media/disk/. It will
add numbers to avoid double names (/media/disk-1). Thus you can not get your wandering home directory mounted
inside /home/ with HAL!
HAL will also signal the desktop, which will act in its own particular way. So in KDE3 this will be different from Gnome,
etc. Also when there are different Desktop logins at the same time (or other programs that registered with HAL), it is not
clear who will get the signal and will be the owner of the mountpoint!
Tools
This being a primer we do not talk much about tools, but some are mentioned (e.g. fdisk, mkfs, mount). As always, they
and configuration files like /etc/fstab have their man-pages on your system (and on the Internet). They are there to be
read by you. While Yast > System > Partitioner is a usefull GUI, you may have to revert to CLI commands in runlevel 3
or single user mode because you need filesystems being unmounted while working on them. For the same reason you
might even have to boot from a rescue CD/DVD running fdisk, and friends, from there (else you would not have an
unmounted /). Bootable GUI tools like Gparted are a step further. They know a lot about the inerrnals of filesystems and
can thus change their size, but this is far beyond the scope of this document.
Links
http://en.wikipedia.org/wiki/Disk_formatting
http://en.wikipedia.org/wiki/Disk_partitioning
http://en.wikipedia.org/wiki/Inode
http://en.wikipedia.org/wiki/Filesystem_Hierarchy_Standard
http://en.wikipedia.org/wiki/Udev
http://en.wikipedia.org/wiki/HAL_(software)
<keyword>partition,filesystem,mountpoint,udev,HAL</keyword>
Categories: SDB:Beginners guides SDB:Filesystems
SDB Discussion View source History
This page has been accessed 101,532 times.
2011 Novell, Inc. and others. All content is made available under the terms of the GNU Free Documentation License version 1.2 ("GFDL") unless expressly otherwise indicated. | Terms of site
converted by W eb2PDFConvert.com