6

I want to know which partition OS installed on my server.
Below is the fdisk and df command outputs from my server.

[root@ ~]# fdisk -l
Disk /dev/sda: 2000.3 GB, 2000398934016 bytes
255 heads, 63 sectors/track, 243201 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1          13      104391   83  Linux
/dev/sda2              14        1058     8393962+  82  Linux swap / Solaris
/dev/sda3            1059        7457    51399967+  83  Linux

[root@ ~]# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/sda3              48G   12G   34G  26% /
/dev/sda1              99M   12M   82M  13% /boot
tmpfs                 7.9G     0  7.9G   0% /dev/shm

I noticed that sda1 has an asterisk on the Boot field. Does it signify that the OS is installed in that partition?

I also came upon this article, but I just want to confirm if the OS is installed on sda1.

Is there any linux command to run or files to open to see which partition the OS is installed on?

Pelang
  • 413
  • 5
  • 9
  • 15

3 Answers3

13

Well technically speaking, in your case, it's installed on two partitions - sda1 and sda3. sda1 is mounted as /boot. This is where the kernel is held. sda3 is the root partition, where the rest of the OS is installed.

EEAA
  • 108,414
  • 18
  • 172
  • 242
  • Thanks @EEAA. That is why I cannot unmount sda3. I was supposed to resize that partition. Anyways that would be for another question. Thanks. – Pelang Nov 22 '12 at 06:26
  • If you consider swap space as part of the OS (I do) then technically it's on *three* partitions (the swap space is on `/dev/sda3`, and while you *can* run a Linux system without swap this one is probably configured to expect it and might do Bad Things if it were not present). Your OS *files* though are on the partitions mentioned above. – voretaq7 Nov 22 '12 at 07:26
4

As an alternate (lower level) way of looking at things from EEAA's answer, your OS is installed on /dev/sda -- all three partitions you've listed are required for proper functioning of your system.

  • /dev/sda3 is / - the root filesystem.
    All the stuff you deal with when using your system is located on this partition.
  • /dev/sda1 is /boot - as the name implies this is where Linux puts "bootup stuff"
    This includes GRUB configurations, kernel modules, etc.
  • /dev/sda2 is your [SWAP] partition.
    Linux uses this as a place to shove program data if you use up all your RAM.
    As your system is apparently configured to expect a swap partition you need this to boot, otherwise when Linux tries to activate swap it will throw an error and ask you to fix it on the console.

NOT SHOWN: The boot block (the really tiny bit of code that gets things going after BIOS is done with its power-on tasks).
The boot block get put in the first disk block of the boot drive (almost certainly /dev/sda in your case), and is really "outside" of the partition layout that you see with df or fdisk.


Regarding the link you posted, for more information on partitioning, see this question and its related answers, you may find it interesting.

voretaq7
  • 79,345
  • 17
  • 128
  • 213
  • Sorry for editing your answer, but you misplaced /dev/sda1 and /dev/sda3, and this in fact completely reversed your answer's meaning. – Massimo Nov 22 '12 at 08:10
1

From what i understand - Your OS is installed on /dev/sda3 as you can see it is mounted on /

The system will boot from sda1

ServerFaulter
  • 181
  • 2
  • 13
  • The system will require the files in `/boot` (little things like the GRUB configuration and the kernel) in order to actually boot... – voretaq7 Nov 22 '12 at 07:27