3

I understand that "sda1" refers to my first hard-drive and the first partition on it but does Linux treat it as a directory or are the backslashes used just for our understanding that the drive is a device the system has access to? Also why do people in the an Arch installation usually mount /dev/sda1 to /mnt? Isn't /dev/sda1 supposed to be the root folder of the OS. Please correct me if I have the wrong impression but I am quite new to Linux fundamentals.

EDIT: Actually I think I understood what is happening. The /mnt belongs to the temporary OS running on the installation disk whereas after installation the /dev/sda1 will become the root folder. Please correct me if I am wrong.

2 Answers 2

6

Actually /dev/sda1 is a block device and when it is mounted (depending on the /etc/fstab mounting map) it shows under a directory (if you want to call it like that) - actually everything in Linux/UNIX is file or directory.

http://www.tldp.org/LDP/Linux-Filesystem-Hierarchy/html/dev.html

/mnt is usually a directory that you can use to mount other block devices, but this is up to your choice of action. You can always create new directories in which you can mount block devices, like your external hard drive or flash drive.

2

sda1 is a "block device file" i.e. a file that defines the block of persistent storage that constitutes the main drive partition. From Wikipedia:

a device file or special file is an interface to a device driver that appears in a file system as if it were an ordinary file.

sda1 breaks down as: sd = mass-storage driver, a = 1st registered device on the driver, 1 = 1st partition on that device

You can use df -h (disk free) to show free space on the hard drive and where it's mounted (try sudo in front if that doesn't work). E.g. it may show that it's mounted as the root:

Filesystem      Size  Used Avail Use% Mounted on
...
/dev/sda1        30G   30G     0 100% /

If you (for example) cd dev then ls -l you'll see that sda1 is prefixed with b:

brw-rw---- 1 root disk

The b prefix identifies that this is specifically a block device file, a type of device file.

You must log in to answer this question.