Query 1. Why only 4 primary partitions
can be created on HDD?
Ans: The MBR (Master Boot Record)
contains boot information & partition table information. MBR is located in
1st sector of HDD or 0th cylinder of HDD. The size of MBR
is 512 bytes in that 446 bytes is used for boot sector and 46 bytes is
allocated for partition table. The remaining 2 bytes are nothing but magic
number which shows “YES” or “NO” value.
MBR is a small program created by
using Assembly language. MBR gets stored in HDD at the time of
installation. In layman language the MBR
will be present only on that disk on which OS is installed.
The partition table is divided into
different programs which manages particular partition.
1 program = 16 bytes = /dev/sda1 =
manages 1st partition
2 program = 16 bytes = /dev/sda2 =
manages 2nd partition
3 program = 16 bytes = /dev/sda1 =
manages 3rd partition
4 program = 16 bytes = /dev/sda1 =
manages 4th partition
So the partition table of size 64
bytes is divided into 4 programs of size 16 bytes each to manage the 4 primary
partitions & that is the reason we can create only 4 primary partitions.
*************************************************************
Query 2: what is “SHUTDOWN
PROCESS”?
Ans: Maximum interviewers ask you
boot process to explain but sometime they may ask you to explain shutdown and
reboot process/sequence.
Run below command for shutting down
server.
[root@ testmachine
~]# poweroff
Or
[root@ testmachine
~]# shutdown –h now
Both commands calls #init 0
in background; the init0 run level is for halting the machine.
To get run level details refer
post:
The init0 will call to /etc/rc
scripts.
Process tree:
/etc/rc = script responsible for
stopping or starting the services.
| -- check run level
| -- /etc/rc$.d/k* = all k=kill
files from specific run level
| -- /etc/rc$.d/s* = all s=start
files from specific run level
| -- /etc/rc.local = use this file,
if you want to run any command or script before login
So now the /etc/rc will check
runlevel and it finds the run level 0 so it will call /etc/rc0.d/ and will run
all the k* related scripts present under this directory.
And will start two processes i.e
S00killall – this process will start and kill if any pending process which is
still running on server. After this, S01halt process will start and this
process will send signal to BIOS to halt/poweroff/shutdown the machine.
[root@testmachine
rc0.d]# ls -lrt |egrep -i "killall|halt"
lrwxrwxrwx 1 root root 14 Aug 17 2015 S01halt -> ../init.d/halt
lrwxrwxrwx 1 root root 17 Aug 17 2015 S00killall -> ../init.d/killall
*************************************************************
Query 3: what is “REBOOT PROCESS”?
Ans: For rebooting the server run
below command:
[root@ testmachine
~]# reboot
Or
[root@ testmachine
~]# shutdown –r now
Both commands calls #init 6
in background; the init6 run level is for rebooting the machine.
The init6 will call to /etc/rc
scripts.
So now the /etc/rc will check
runlevel and it finds the run level 6 so it will call /etc/rc6.d/ and will run
all the k* related scripts present under this directory.
And will start two processes i.e
S00killall – this process will start and kill if any pending process which is
still running on server. After this, S01reboot process will start and it will send
signal to BIOS to reboot/restart the machine.
[root@testmachine
rc6.d]# ls -lrt |egrep -i "killall|reboot"
lrwxrwxrwx 1 root root 14 Aug 17 2015 S01reboot -> ../init.d/halt
lrwxrwxrwx 1 root root 17 Aug 17 2015 S00killall -> ../init.d/killall
Note: The only difference is that,
in shutdown process OS send halt signal (S01halt) from /etc/rc0.d to BIOS and
in reboot process we send reboot signal (S01reboot) from /etc/rc6.d to BIOS.
Thanks
& Regards,
Kiran
Jadhav
No comments:
Post a Comment