I think you lack basic concept of Linux (Unix) filesystem organization.
First of all - as you may have noticed - there are no drive letters. Instead, there is a filesystem tree, starting at "/" (pronounced "root") directory.
Root directory resides on root device (usually partition, but it can be whole disk, floppy disk, ram-disk, raid partition, dynamic volume (LVM or EVMS), or similar).
Exercise 1: To quickly find out on what device your root filesystem resides, type this in a terminal window:
Linux gives you full access to all the stuff mentioned above via handles in /dev directory. Having necessary permissions you can dump, view, zero, format or even edit your drives directly. So
be extremely careful when visiting /dev directory as root.
Exercise 2:
Code:
hexdump -Cn 200 /dev/sda
Naming conventions are pretty simple:
- /dev/hdx refers to IDE drives and CD/DVD/BD devices (and sATA drives in legacy mode)
- /dev/sdx means SCSI disks (including sATA, USB drives and pen drives and anything using SCSI protocol
- /dev/mdn refers to MD (software RAID) devices
"x" are letters "a", "b", "c"... etc for subsequent drives, "n" = 0, 1, 2, 3...
As you may already know, disks partitioned in DOS-compatible style can have up to 4 primary partitions of which one can be extended partition, containing any number of logical drives. Therefore numbers 1-4 immediately following hdx/sdx in device name are reserved for primary partitions, while 5 and above denote logical drives.
So /dev/hda1 would be "first primary partition on primary master ide drive" while /dev/sdj8 would be "fourth logical drive on tenth scsi drive"
Note: SCSI devices are enumerated in order they are detected by kernel. MD device numbers are user-definable.
Very important note: Partitions are enumerated in partition table order and logical disks chain order, NOT in order of space they physically occupy on disk.
The simplest yet sufficient tool to repartition drives in Linux is called
fdisk.
Exercise 3: To list partitions on all devices in your system, simply type
Exercise 4: Compare output of commands:
Code:
fdisk -l
mount
df -h
ls -l /dev/[hms]d*
So when hard drive is partitioned and formatted, one usually picks a partition to be his(/her) root partition. Other partitions are
mounted in some directory of directory tree.
Example 1:
Suppose you have two disks: /dev/sda with 4 primary partitions and /dev/sdb formatted as whole device (not partitioned at all) - you can do this in Linux. And let /dev/sda3 be your root partition, containing following directories:
- /bin
- /boot
- /etc
- /home
- /usr
Suppose /dev/sda2 contains following directories:
Now you may decide to mount /dev/sda1 under /boot, /dev/sda2 under /home, and /dev/sda4 under /usr. After that your directory tree will look like this:
- /bin
- /boot
- /etc
- /home
- /home/alice
- /home/bob
- /home/charlie
- /usr
As you can see, directories from /dev/sda2 partition became visible under /home directory. And this happen always when you 'mount' device under directory (mount point) - mount point's contents became covered (hidden) and contents of freshly mounted partition becomes visible instead.
At this point you may decide to mount /dev/sdb under /home/charlie, giving Charlie access to full, unpartitioned second drive.
Exercise 5: Where will go files (to which partition) written to every directory listed above?
Answer:- Files written to /home/charlie will go to /dev/sdb
- Files written to /home/alice, /home/bob and /home will go to /dev/sda2
- Files written to /usr will go to /dev/sda4
- Files written to /boot will go to /dev/sda1
- Files written anywhere else will end up in your root partition, /dev/sda3
Having read all this, there is no point in reformatting/reinstalling system. Just move files between partitions to get desired setup. It's easier, safer, faster, more controllable.
Take care.