You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

468 lines
17 KiB

  1. <?xml version="1.0" encoding="utf-8"?>
  2. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
  3. "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
  4. <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
  5. <head>
  6. <!-- 2023-02-09 Thu 23:36 -->
  7. <meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
  8. <meta name="viewport" content="width=device-width, initial-scale=1" />
  9. <title>Lab2 Solution Amirlan Sharipov (BS21-CS-01)</title>
  10. <meta name="author" content="Amirlan Sharipov (BS21-CS-01)" />
  11. <meta name="generator" content="Org Mode" />
  12. <style>
  13. #content { max-width: 60em; margin: auto; }
  14. .title { text-align: center;
  15. margin-bottom: .2em; }
  16. .subtitle { text-align: center;
  17. font-size: medium;
  18. font-weight: bold;
  19. margin-top:0; }
  20. .todo { font-family: monospace; color: red; }
  21. .done { font-family: monospace; color: green; }
  22. .priority { font-family: monospace; color: orange; }
  23. .tag { background-color: #eee; font-family: monospace;
  24. padding: 2px; font-size: 80%; font-weight: normal; }
  25. .timestamp { color: #bebebe; }
  26. .timestamp-kwd { color: #5f9ea0; }
  27. .org-right { margin-left: auto; margin-right: 0px; text-align: right; }
  28. .org-left { margin-left: 0px; margin-right: auto; text-align: left; }
  29. .org-center { margin-left: auto; margin-right: auto; text-align: center; }
  30. .underline { text-decoration: underline; }
  31. #postamble p, #preamble p { font-size: 90%; margin: .2em; }
  32. p.verse { margin-left: 3%; }
  33. pre {
  34. border: 1px solid #e6e6e6;
  35. border-radius: 3px;
  36. background-color: #f2f2f2;
  37. padding: 8pt;
  38. font-family: monospace;
  39. overflow: auto;
  40. margin: 1.2em;
  41. }
  42. pre.src {
  43. position: relative;
  44. overflow: auto;
  45. }
  46. pre.src:before {
  47. display: none;
  48. position: absolute;
  49. top: -8px;
  50. right: 12px;
  51. padding: 3px;
  52. color: #555;
  53. background-color: #f2f2f299;
  54. }
  55. pre.src:hover:before { display: inline; margin-top: 14px;}
  56. /* Languages per Org manual */
  57. pre.src-asymptote:before { content: 'Asymptote'; }
  58. pre.src-awk:before { content: 'Awk'; }
  59. pre.src-authinfo::before { content: 'Authinfo'; }
  60. pre.src-C:before { content: 'C'; }
  61. /* pre.src-C++ doesn't work in CSS */
  62. pre.src-clojure:before { content: 'Clojure'; }
  63. pre.src-css:before { content: 'CSS'; }
  64. pre.src-D:before { content: 'D'; }
  65. pre.src-ditaa:before { content: 'ditaa'; }
  66. pre.src-dot:before { content: 'Graphviz'; }
  67. pre.src-calc:before { content: 'Emacs Calc'; }
  68. pre.src-emacs-lisp:before { content: 'Emacs Lisp'; }
  69. pre.src-fortran:before { content: 'Fortran'; }
  70. pre.src-gnuplot:before { content: 'gnuplot'; }
  71. pre.src-haskell:before { content: 'Haskell'; }
  72. pre.src-hledger:before { content: 'hledger'; }
  73. pre.src-java:before { content: 'Java'; }
  74. pre.src-js:before { content: 'Javascript'; }
  75. pre.src-latex:before { content: 'LaTeX'; }
  76. pre.src-ledger:before { content: 'Ledger'; }
  77. pre.src-lisp:before { content: 'Lisp'; }
  78. pre.src-lilypond:before { content: 'Lilypond'; }
  79. pre.src-lua:before { content: 'Lua'; }
  80. pre.src-matlab:before { content: 'MATLAB'; }
  81. pre.src-mscgen:before { content: 'Mscgen'; }
  82. pre.src-ocaml:before { content: 'Objective Caml'; }
  83. pre.src-octave:before { content: 'Octave'; }
  84. pre.src-org:before { content: 'Org mode'; }
  85. pre.src-oz:before { content: 'OZ'; }
  86. pre.src-plantuml:before { content: 'Plantuml'; }
  87. pre.src-processing:before { content: 'Processing.js'; }
  88. pre.src-python:before { content: 'Python'; }
  89. pre.src-R:before { content: 'R'; }
  90. pre.src-ruby:before { content: 'Ruby'; }
  91. pre.src-sass:before { content: 'Sass'; }
  92. pre.src-scheme:before { content: 'Scheme'; }
  93. pre.src-screen:before { content: 'Gnu Screen'; }
  94. pre.src-sed:before { content: 'Sed'; }
  95. pre.src-sh:before { content: 'shell'; }
  96. pre.src-sql:before { content: 'SQL'; }
  97. pre.src-sqlite:before { content: 'SQLite'; }
  98. /* additional languages in org.el's org-babel-load-languages alist */
  99. pre.src-forth:before { content: 'Forth'; }
  100. pre.src-io:before { content: 'IO'; }
  101. pre.src-J:before { content: 'J'; }
  102. pre.src-makefile:before { content: 'Makefile'; }
  103. pre.src-maxima:before { content: 'Maxima'; }
  104. pre.src-perl:before { content: 'Perl'; }
  105. pre.src-picolisp:before { content: 'Pico Lisp'; }
  106. pre.src-scala:before { content: 'Scala'; }
  107. pre.src-shell:before { content: 'Shell Script'; }
  108. pre.src-ebnf2ps:before { content: 'ebfn2ps'; }
  109. /* additional language identifiers per "defun org-babel-execute"
  110. in ob-*.el */
  111. pre.src-cpp:before { content: 'C++'; }
  112. pre.src-abc:before { content: 'ABC'; }
  113. pre.src-coq:before { content: 'Coq'; }
  114. pre.src-groovy:before { content: 'Groovy'; }
  115. /* additional language identifiers from org-babel-shell-names in
  116. ob-shell.el: ob-shell is the only babel language using a lambda to put
  117. the execution function name together. */
  118. pre.src-bash:before { content: 'bash'; }
  119. pre.src-csh:before { content: 'csh'; }
  120. pre.src-ash:before { content: 'ash'; }
  121. pre.src-dash:before { content: 'dash'; }
  122. pre.src-ksh:before { content: 'ksh'; }
  123. pre.src-mksh:before { content: 'mksh'; }
  124. pre.src-posh:before { content: 'posh'; }
  125. /* Additional Emacs modes also supported by the LaTeX listings package */
  126. pre.src-ada:before { content: 'Ada'; }
  127. pre.src-asm:before { content: 'Assembler'; }
  128. pre.src-caml:before { content: 'Caml'; }
  129. pre.src-delphi:before { content: 'Delphi'; }
  130. pre.src-html:before { content: 'HTML'; }
  131. pre.src-idl:before { content: 'IDL'; }
  132. pre.src-mercury:before { content: 'Mercury'; }
  133. pre.src-metapost:before { content: 'MetaPost'; }
  134. pre.src-modula-2:before { content: 'Modula-2'; }
  135. pre.src-pascal:before { content: 'Pascal'; }
  136. pre.src-ps:before { content: 'PostScript'; }
  137. pre.src-prolog:before { content: 'Prolog'; }
  138. pre.src-simula:before { content: 'Simula'; }
  139. pre.src-tcl:before { content: 'tcl'; }
  140. pre.src-tex:before { content: 'TeX'; }
  141. pre.src-plain-tex:before { content: 'Plain TeX'; }
  142. pre.src-verilog:before { content: 'Verilog'; }
  143. pre.src-vhdl:before { content: 'VHDL'; }
  144. pre.src-xml:before { content: 'XML'; }
  145. pre.src-nxml:before { content: 'XML'; }
  146. /* add a generic configuration mode; LaTeX export needs an additional
  147. (add-to-list 'org-latex-listings-langs '(conf " ")) in .emacs */
  148. pre.src-conf:before { content: 'Configuration File'; }
  149. table { border-collapse:collapse; }
  150. caption.t-above { caption-side: top; }
  151. caption.t-bottom { caption-side: bottom; }
  152. td, th { vertical-align:top; }
  153. th.org-right { text-align: center; }
  154. th.org-left { text-align: center; }
  155. th.org-center { text-align: center; }
  156. td.org-right { text-align: right; }
  157. td.org-left { text-align: left; }
  158. td.org-center { text-align: center; }
  159. dt { font-weight: bold; }
  160. .footpara { display: inline; }
  161. .footdef { margin-bottom: 1em; }
  162. .figure { padding: 1em; }
  163. .figure p { text-align: center; }
  164. .equation-container {
  165. display: table;
  166. text-align: center;
  167. width: 100%;
  168. }
  169. .equation {
  170. vertical-align: middle;
  171. }
  172. .equation-label {
  173. display: table-cell;
  174. text-align: right;
  175. vertical-align: middle;
  176. }
  177. .inlinetask {
  178. padding: 10px;
  179. border: 2px solid gray;
  180. margin: 10px;
  181. background: #ffffcc;
  182. }
  183. #org-div-home-and-up
  184. { text-align: right; font-size: 70%; white-space: nowrap; }
  185. textarea { overflow-x: auto; }
  186. .linenr { font-size: smaller }
  187. .code-highlighted { background-color: #ffff00; }
  188. .org-info-js_info-navigation { border-style: none; }
  189. #org-info-js_console-label
  190. { font-size: 10px; font-weight: bold; white-space: nowrap; }
  191. .org-info-js_search-highlight
  192. { background-color: #ffff00; color: #000000; font-weight: bold; }
  193. .org-svg { }
  194. </style>
  195. </head>
  196. <body>
  197. <div id="content" class="content">
  198. <h1 class="title">Lab2 Solution Amirlan Sharipov (BS21-CS-01)</h1>
  199. <div id="table-of-contents" role="doc-toc">
  200. <h2>Table of Contents</h2>
  201. <div id="text-table-of-contents" role="doc-toc">
  202. <ul>
  203. <li><a href="#orgab91f72">1. Questions 1</a>
  204. <ul>
  205. <li><a href="#org5b80d60">1.1. What is fdisk utility used for?</a></li>
  206. <li><a href="#org0c664e2">1.2. Show the bootable device(s) on your machine, and identify which partition(s) are bootable.</a>
  207. <ul>
  208. <li><a href="#orged3ed3c">1.2.1. Output of fdisk -l:</a></li>
  209. <li><a href="#orga4fdfef">1.2.2. Answer</a></li>
  210. </ul>
  211. </li>
  212. <li><a href="#orgb7c19d5">1.3. What is logical block address?</a></li>
  213. <li><a href="#orgd76c04a">1.4. Why did we specify the count, the bs, and the skip options when using dd?</a></li>
  214. <li><a href="#org396d8fc">1.5. Why does a GPT formatted disk have the MBR?</a></li>
  215. <li><a href="#org47988d3">1.6. Name two differences between primary and logical partitions in an MBR partitioning scheme</a></li>
  216. </ul>
  217. </li>
  218. <li><a href="#orgd07cf30">2. Questions 2</a>
  219. <ul>
  220. <li><a href="#org7dd9497">2.1. Why is Shim used to load the GRUB bootloader?</a></li>
  221. <li><a href="#orgdf33504">2.2. Can you locate your grub configuration file? Show the path.</a></li>
  222. <li><a href="#orge9d54d1">2.3. According to the boot order, what is the third boot device on your computer? How did you check this?</a></li>
  223. </ul>
  224. </li>
  225. <li><a href="#orgdc23d89">3. Questions 3</a>
  226. <ul>
  227. <li><a href="#orgd513e26">3.1. How many inodes are in use on your system?</a></li>
  228. <li><a href="#orge9e0733">3.2. What is the filesystem type of the EFI partition?</a></li>
  229. <li><a href="#org8478339">3.3. What device is mounted at your root / directory? Show proof.</a></li>
  230. <li><a href="#org3c9680d">3.4. What is your partition UUID?</a></li>
  231. <li><a href="#org9f79854">3.5. Show at least two methods of viewing the UUID of a block device.</a></li>
  232. <li><a href="#org4b16e3f">3.6. What is the function of /dev/zero?</a></li>
  233. </ul>
  234. </li>
  235. </ul>
  236. </div>
  237. </div>
  238. <div id="outline-container-orgab91f72" class="outline-2">
  239. <h2 id="orgab91f72"><span class="section-number-2">1.</span> Questions 1</h2>
  240. <div class="outline-text-2" id="text-1">
  241. </div>
  242. <div id="outline-container-org5b80d60" class="outline-3">
  243. <h3 id="org5b80d60"><span class="section-number-3">1.1.</span> What is fdisk utility used for?</h3>
  244. <div class="outline-text-3" id="text-1-1">
  245. <p>
  246. to manipulate disk partition table
  247. </p>
  248. </div>
  249. </div>
  250. <div id="outline-container-org0c664e2" class="outline-3">
  251. <h3 id="org0c664e2"><span class="section-number-3">1.2.</span> Show the bootable device(s) on your machine, and identify which partition(s) are bootable.</h3>
  252. <div class="outline-text-3" id="text-1-2">
  253. </div>
  254. <div id="outline-container-orged3ed3c" class="outline-4">
  255. <h4 id="orged3ed3c"><span class="section-number-4">1.2.1.</span> Output of fdisk -l:</h4>
  256. <div class="outline-text-4" id="text-1-2-1">
  257. <p>
  258. &#x2026;
  259. Device Start End Sectors Size Type
  260. /dev/sdb1 2048 34815 32768 16M Microsoft reserved
  261. /dev/sdb2 34816 524285951 524251136 250G Microsoft basic data
  262. /dev/sdb3 524285952 659988479 135702528 64.7G Linux filesystem
  263. /dev/sdb4 659988480 863920127 203931648 97.2G Linux filesystem
  264. /dev/sdb5 958291968 975173631 16881664 8G Linux swap
  265. /dev/sdb6 975173632 976773134 1599503 781M EFI System
  266. /dev/sdb7 863920128 956194815 92274688 44G Linux filesystem
  267. /dev/sdb8 956194816 958291967 2097152 1G EFI System
  268. </p>
  269. </div>
  270. </div>
  271. <div id="outline-container-orga4fdfef" class="outline-4">
  272. <h4 id="orga4fdfef"><span class="section-number-4">1.2.2.</span> Answer</h4>
  273. <div class="outline-text-4" id="text-1-2-2">
  274. <p>
  275. /dev/sdb6 and /dev/sdb8 are bootable partitions
  276. </p>
  277. </div>
  278. </div>
  279. </div>
  280. <div id="outline-container-orgb7c19d5" class="outline-3">
  281. <h3 id="orgb7c19d5"><span class="section-number-3">1.3.</span> What is logical block address?</h3>
  282. <div class="outline-text-3" id="text-1-3">
  283. <p>
  284. is a scheme to index the locations of logical blocks of a device. Starts with LBA 0
  285. </p>
  286. </div>
  287. </div>
  288. <div id="outline-container-orgd76c04a" class="outline-3">
  289. <h3 id="orgd76c04a"><span class="section-number-3">1.4.</span> Why did we specify the count, the bs, and the skip options when using dd?</h3>
  290. <div class="outline-text-3" id="text-1-4">
  291. <p>
  292. Number of blocks, block size, and how many blocks to skip
  293. </p>
  294. </div>
  295. </div>
  296. <div id="outline-container-org396d8fc" class="outline-3">
  297. <h3 id="org396d8fc"><span class="section-number-3">1.5.</span> Why does a GPT formatted disk have the MBR?</h3>
  298. <div class="outline-text-3" id="text-1-5">
  299. <p>
  300. To maintain compatibility and protect GPT disk and from MBR-based disk utilities.
  301. </p>
  302. </div>
  303. </div>
  304. <div id="outline-container-org47988d3" class="outline-3">
  305. <h3 id="org47988d3"><span class="section-number-3">1.6.</span> Name two differences between primary and logical partitions in an MBR partitioning scheme</h3>
  306. <div class="outline-text-3" id="text-1-6">
  307. <p>
  308. There can be only 4 primary partitions in MBR disk, while there can be many logical ones on top of an extended partition. Some operating systems cannot boot from a logical partition.
  309. </p>
  310. </div>
  311. </div>
  312. </div>
  313. <div id="outline-container-orgd07cf30" class="outline-2">
  314. <h2 id="orgd07cf30"><span class="section-number-2">2.</span> Questions 2</h2>
  315. <div class="outline-text-2" id="text-2">
  316. </div>
  317. <div id="outline-container-org7dd9497" class="outline-3">
  318. <h3 id="org7dd9497"><span class="section-number-3">2.1.</span> Why is Shim used to load the GRUB bootloader?</h3>
  319. <div class="outline-text-3" id="text-2-1">
  320. <p>
  321. To make Secure Boot mechanism work.
  322. </p>
  323. </div>
  324. </div>
  325. <div id="outline-container-orgdf33504" class="outline-3">
  326. <h3 id="orgdf33504"><span class="section-number-3">2.2.</span> Can you locate your grub configuration file? Show the path.</h3>
  327. <div class="outline-text-3" id="text-2-2">
  328. <p>
  329. /boot/grub/grub.cfg
  330. Also, there is /etc/default/grub which can be used to generate a grub config using grub-mkconfig
  331. </p>
  332. </div>
  333. </div>
  334. <div id="outline-container-orge9d54d1" class="outline-3">
  335. <h3 id="orge9d54d1"><span class="section-number-3">2.3.</span> According to the boot order, what is the third boot device on your computer? How did you check this?</h3>
  336. <div class="outline-text-3" id="text-2-3">
  337. <p>
  338. BootCurrent: 0003
  339. Timeout: 0 seconds
  340. BootOrder: 0003,0004,0009,0001,0002,0000,2001,0006,0005,2002,2003
  341. &#x2026;
  342. Boot0009* Artix HD(10,GPT,&#x2026;
  343. It&rsquo;s Artix on my hard drive, accoding to efibootmgr -v
  344. </p>
  345. </div>
  346. </div>
  347. </div>
  348. <div id="outline-container-orgdc23d89" class="outline-2">
  349. <h2 id="orgdc23d89"><span class="section-number-2">3.</span> Questions 3</h2>
  350. <div class="outline-text-2" id="text-3">
  351. </div>
  352. <div id="outline-container-orgd513e26" class="outline-3">
  353. <h3 id="orgd513e26"><span class="section-number-3">3.1.</span> How many inodes are in use on your system?</h3>
  354. <div class="outline-text-3" id="text-3-1">
  355. <div class="org-src-container">
  356. <pre class="src src-bash">df --output=source,iused
  357. </pre>
  358. </div>
  359. <pre class="example" id="org1e237a1">
  360. Filesystem IUsed
  361. dev 717
  362. run 1314
  363. /dev/sdb3 720461
  364. tmpfs 1
  365. tmpfs 26
  366. /dev/sdb4 677813
  367. /dev/sdb6 0
  368. tmpfs 71
  369. /dev/sda9 16193
  370. /dev/sda8 33171
  371. </pre>
  372. </div>
  373. </div>
  374. <div id="outline-container-orge9e0733" class="outline-3">
  375. <h3 id="orge9e0733"><span class="section-number-3">3.2.</span> What is the filesystem type of the EFI partition?</h3>
  376. <div class="outline-text-3" id="text-3-2">
  377. <p>
  378. FAT32
  379. </p>
  380. </div>
  381. </div>
  382. <div id="outline-container-org8478339" class="outline-3">
  383. <h3 id="org8478339"><span class="section-number-3">3.3.</span> What device is mounted at your root / directory? Show proof.</h3>
  384. <div class="outline-text-3" id="text-3-3">
  385. <div class="org-src-container">
  386. <pre class="src src-bash">lsblk
  387. </pre>
  388. </div>
  389. <pre class="example" id="org1ee58fc">
  390. NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS
  391. sda 8:0 0 931.5G 0 disk
  392. ├─sda1 8:1 0 499M 0 part
  393. ├─sda2 8:2 0 100M 0 part
  394. ├─sda3 8:3 0 16M 0 part
  395. ├─sda4 8:4 0 42.4G 0 part
  396. ├─sda5 8:5 0 38.8G 0 part
  397. ├─sda6 8:6 0 100M 0 part
  398. ├─sda7 8:7 0 3.1G 0 part
  399. ├─sda8 8:8 0 315G 0 part /mnt/rec
  400. └─sda9 8:9 0 531.5G 0 part /mnt/data
  401. sdb 8:16 0 465.8G 0 disk
  402. ├─sdb1 8:17 0 16M 0 part
  403. ├─sdb2 8:18 0 250G 0 part
  404. ├─sdb3 8:19 0 64.7G 0 part /
  405. ├─sdb4 8:20 0 97.2G 0 part /home
  406. ├─sdb5 8:21 0 8G 0 part [SWAP]
  407. ├─sdb6 8:22 0 781M 0 part /boot
  408. ├─sdb7 8:23 0 44G 0 part
  409. └─sdb8 8:24 0 1G 0 part
  410. </pre>
  411. <p>
  412. /dev/sdb3
  413. </p>
  414. </div>
  415. </div>
  416. <div id="outline-container-org3c9680d" class="outline-3">
  417. <h3 id="org3c9680d"><span class="section-number-3">3.4.</span> What is your partition UUID?</h3>
  418. <div class="outline-text-3" id="text-3-4">
  419. <p>
  420. For PARTUUID:
  421. </p>
  422. <div class="org-src-container">
  423. <pre class="src src-bash">lsblk -dno PARTUUID /dev/sdb3
  424. </pre>
  425. </div>
  426. <pre class="example">
  427. fbef9613-fbf5-8445-8d1c-7a63709d1229
  428. </pre>
  429. </div>
  430. </div>
  431. <div id="outline-container-org9f79854" class="outline-3">
  432. <h3 id="org9f79854"><span class="section-number-3">3.5.</span> Show at least two methods of viewing the UUID of a block device.</h3>
  433. <div class="outline-text-3" id="text-3-5">
  434. <p>
  435. lsblk -dno UUID /dev/sdb3
  436. blkid
  437. </p>
  438. </div>
  439. </div>
  440. <div id="outline-container-org4b16e3f" class="outline-3">
  441. <h3 id="org4b16e3f"><span class="section-number-3">3.6.</span> What is the function of /dev/zero?</h3>
  442. <div class="outline-text-3" id="text-3-6">
  443. <p>
  444. Source of zero bytes. Can be used with dd to fill a file with zeros.
  445. </p>
  446. </div>
  447. </div>
  448. </div>
  449. </div>
  450. <div id="postamble" class="status">
  451. <p class="author">Author: Amirlan Sharipov (BS21-CS-01)</p>
  452. <p class="date">Created: 2023-02-09 Thu 23:36</p>
  453. </div>
  454. </body>
  455. </html>