Not to be too blunt, but everything you know about disk storage is wrong!
(Or at least based on a fundamentally broken paradigm that Windows inherited from DOS, which inherited it from CP/M).
A brief and woefully incomplete introduction to Unix filesystems
At the user/filesystem level Unix doesn't care what physical device it's using. There is only the one true great and bountiful directory hierarchy (tree), rooted at /
(root), under which all things live.
Filesystems are created on disk devices (/dev/sda1
, /dev/sda2
, /dev/sdb1
, etc.) and mounted at the location where you want to logically access them.
For example, /dev/sda1
(Windows drive C:
, the first hard disk) is probably mounted at /
(root).
You may then have /dev/sda2
mounted at /usr
containing all of your "userland" programs, and /dev/sda3
mounted at /home
containing all the user home directories. /dev/sdb1
might be mounted on /var
to hold log files so they don't fill up your boot drive, etc.
The physical structure (which disks/partitions are associated with which mount points) is something you decide on when building the system, based on projected need/growth.
The logical structure (directory names and what goes in them) is standardized, and documented in your system manual (the hier
man page -- hier(7) from a Linux system
, and from a BSD system).
You can see which partitions (filesystems) are mounted where by running the mount
command:
[mgraziano@monitor ~]$ mount
/dev/da0s1a on / (ufs, local)
devfs on /dev (devfs, local)
/dev/da0s1h on /home (ufs, local, soft-updates)
/dev/da0s2d on /opt (ufs, local, soft-updates)
/dev/da0s1g on /tmp (ufs, local, soft-updates)
/dev/da0s1e on /usr (ufs, local, soft-updates)
/dev/da0s1f on /usr/local (ufs, local, soft-updates)
/dev/da1s1d on /usr/local/pgsql/data (ufs, local, soft-updates)
/dev/da3s1d on /usr/local/pgsql/data/pg_xlog (ufs, local, soft-updates)
/dev/da2s1d on /usr/local/pgsql/data/xlog_archive (ufs, local, soft-updates)
/dev/da0s1d on /var (ufs, local, soft-updates)
and you can get more information (like space available) by using the df
command:
[mgraziano@monitor ~]$ df -h
Filesystem Size Used Avail Capacity Mounted on
/dev/da0s1a 2G 73M 1.7G 4% /
devfs 1.0k 1.0k 0B 100% /dev
/dev/da0s1h 18G 6.3M 16G 0% /home
/dev/da0s2d 63G 7.4M 58G 0% /opt
/dev/da0s1g 2G 14k 1.8G 0% /tmp
/dev/da0s1e 9.7G 810M 8.1G 9% /usr
/dev/da0s1f 14G 1.9G 11G 14% /usr/local
/dev/da1s1d 266G 21G 223G 9% /usr/local/pgsql/data
/dev/da3s1d 130G 128M 120G 0% /usr/local/pgsql/data/pg_xlog
/dev/da2s1d 266G 2.1G 242G 1% /usr/local/pgsql/data/xlog_archive
/dev/da0s1d 9.7G 308M 8.6G 3% /var
The results above are from a FreeBSD system, so the device names are different, but the general format of the output is the same.
So what's the answer to your question? -- "You're thinking about it wrong."
When you install a package like MySQL on a Unix system it will (hopefully) adhere to the conventions in the hier
documentation. For example:
- MySQL's configuration files will probably go in
/etc/mysql/
- The MySQL database files will probably go in
/var/db/mysql/
- The MySQL client binary will probably be installed as
/usr/bin/mysql
- The MySQL dump program will probably be installed as
/usr/sbin/mysqldump
- The MySQL daemon (the DB server program) will probably be
/usr/sbin/mysqld
- Startup scripts will probably be installed in
/etc
so the DB starts when the system boots.
What matters for the installation (and the user) is the logical location in the filesystem hierarchy. The concept of the underlying physical disk is abstracted away entirely (except if you run out of space, and the assumption is that you (the system administrator) have made your partitions large enough to accommodate what's being installed).
The abstraction offered by Unix filesystems has a number of benefits, among them the ability to cover mistakes made in the initial partitioning.
For example if the /var
partition on your system is on is only 10GB but you expect MySQL to store 100GB of data you might go out and buy a new hard drive, install it, and mount it at /var/db/mysql
so you have enough room for your database.
As an example, look at the df
output I provided above - /usr/local/pgsql/data
(my Postgres database directory) resides on a separate, larger partition from /usr/local
(which itself is separated from /usr
).