The concept of Drives in Unix Systems

filesystemshard-diskmountpartition

In windows, we have C drives where all the softwares are installed and other partitions e.g; D, E etc to store our data. Now once we reinstall the windows for some reason, we install everything again on C and our data is kept safe and can access it without any problem.

Now in Unix type OS, each user is given a home directory (I believe Windows also has something like that) and we can only put our data in that part of the system (this is what I think). Now how can someone can get the effect of windows, where at a certain part of hard drive, a user can put his/her data and when reinstalling the Unix/Linux system, reclaim that data?

Best Answer

You have various devices on UNIX/Linux that represent physical drives so for example on Linux:

/dev/sda  -  Would designate SCSI drive with ID of 0 or lately more commonly ID:0 on SATA.
/dev/sdb  -  Would be secondary device, etc

Linux when it installs will ask you where to install it on and you can designate /dev/sda as your OS drive and you can designate /dev/sdb as the location for /home which will be formatted and mounted if you choose it to be.

You will create partitions on the OS drive designating one for swap, /boot, / filesystems, which will basically create devices like /dev/sda1, 2, 3 which will look to your system as physical devices and they will be made accessible to the OS in forms of directories.

So in this set up /dev/sda would be Windows equivalent of C:\ drive and /dev/sdb would be the equivalent of the data drive, whatever letter designation you choose.

So if you choose to reinstall Linux all you will have to be careful of is actually not reformatting /dev/sdb or the partitions that you set up on it so that the data you have on that driver remains intact.

Now similar concept can be applied if there is only one drive on the system, but this will be a little more complex of a concept that Windows also support but most commonly not being used.

Related Question