Lab4-Linux Partition-22F

pdf

School

Algonquin College *

*We aren’t endorsed by this school

Course

CST8101

Subject

Computer Science

Date

Apr 3, 2024

Type

pdf

Pages

19

Uploaded by CaptainField13890

Report
Lab 4 CST8101 – Computer Essentials ©Algonquin College March 24, 2024 Page 1 of 19 Linux partition Due date: at the end of your lab period Note: all commands in this lab will be used during quizzes and exams. Mark: 10 7 screenshots and 3 question Marking scheme: Missing any snapshot or wrong answer for each question would cost 1 mark Purpose: Create a Linux clone create and remove MBR partitions from a Linux Virtual Hard Disk (2 GB) change Sudo password (administrator password) install the tree application Procedure: Important: - in this lab, we will be using the Linux clone in case you mess things up. there are some questions in the lab, make sure you answer the questions in RED and have snapshots of your work. All commands in this lab are lowercase. Create a clone of your Linux os Please turn on and log in to your Ubuntu. You are learning how to shut down Linux through the command line ( Terminal). How to shutdown your Ubuntu in the command line or terminal: First, log in to your Ubuntu. On your Ubuntu desktop press Ctrl+alt+T at the same time. That takes you to the Terminal screen. On the user prompt type: sudo shutdown -h now press enter (all lower case) ( exam ) Provide the user password now your VM is off and you are on the VM main page.
Lab 4 CST8101 – Computer Essentials ©Algonquin College March 24, 2024 Page 2 of 19 3-In your VM screen select VM => Manage => Clone To create a clone partition. Click Next Click Next After going through the default setting the clone type screen comes up, select Create a full clone click Next
Lab 4 CST8101 – Computer Essentials ©Algonquin College March 24, 2024 Page 3 of 19 Click Next Then finish The cloning process takes a few minutes Click Close Adding a new virtual hard drive (2 GB) to the clone VM Select (highlight) your Linux clone from your VM library and add a new virtual hard disk. Double click on your VM hard Disk (SCSI), this brings up the Virtual Machine Settings as shown in Figure 1 below . Note: your hard drive type may not be SCSI, which is ok.
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Lab 4 CST8101 – Computer Essentials ©Algonquin College March 24, 2024 Page 4 of 19 Figure 1 Double Click on the Hard Disk (SCSI) Select the Hard Disk and click on the Add button; located at the bottom of the screen on the left-hand side. This brings up the Add Hardware Wizard , see Figure 2. Select the Hard Disk and click the Next button. Figure 2 Add Hardware Wizard. Accept the default options from the Select a Disk Type Menu and click the Next button. Select the Create a new virtual disk radio button and click the Next button. Select a Maxim disk size of 2 GB and choose the Store virtual disk as a single file , as shown in Figure 3 below.
Lab 4 CST8101 – Computer Essentials ©Algonquin College March 24, 2024 Page 5 of 19 Figure 3 Hard Disk Size. Click the Next button and accept the default name for the disk file. Click Finish. You will now be taken to the Virtual Machine Settings menu, and you should see a 2 GB drive displayed. Click the OK button.
Lab 4 CST8101 – Computer Essentials ©Algonquin College March 24, 2024 Page 6 of 19 Screenshot 1 : showing 2 GB drive ( 1 Mark) your name Figure 1 ““ Power on the Virtual Machine (Clone Ubuntu) and log on to your Linux VM. Exercise 1: Viewing existing partitions from Terminal (clone) On the Ubuntu desktop screen, press the Ctrl + alt +T buttons at the same time. That takes to the terminal screen. Switch to the root user (administrator) with the command: sudo -s – root press enter When prompted enter your root password (user password) and hit enter , remember nothing will show on the screen when you type your password. ( Exam ). Linux is a case-sensitive operating system. Note : the prompt user has been changed from ~$ to ~ # (sudo prompt) ( Exam)
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Lab 4 CST8101 – Computer Essentials ©Algonquin College March 24, 2024 Viewing an existing partition in the drive /Dev /sda ( memorize these letters) To create or see partitions in Linux, we will be using fdisk command (Exam) The syntax of the fdisk command is ~# fdisk /dev/device_name (example) Type fdisk /dev/sda press enter (be careful, there is a space between fdisk and /dev/sda) Within the fdisk utility type m for a list of menu options at the "Command ( m for help):" prompt List of letters or commands to memorize (exam)
Lab 4 CST8101 – Computer Essentials ©Algonquin College March 24, 2024 Questions Record the (one-character) fdisk command to :( in Red) o Display/print all partitions: _ p _ o create (add ) a new partition: _ n _ o delete a partition: _ d __ o change partition types: _ t __ o save changes made to the partition table: _ w _ o exit fdisk without saving: _ q _ Select the option that lists the partition types and record the system id of the following Note: System ID numbers are on the left side of the column. example: 85 Linux extended o "Linux ": _ 83 __ o "Linux swap": _ 82 __ In the terminal command (m for help) type p to display all partitions in the /dev/ sda
Lab 4 CST8101 – Computer Essentials ©Algonquin College March 24, 2024 How many Devices (partitions) do you see in the /dev/ sda partition? What is device name 1: sda1 What is the size of device 1 in GB? 18.6G What is device name 2: sda2 What is the size of device 2 in GB? 1.9G Screenshot 2 : two partitions (/dev/ sda) your name ( 1 mark ) Figure 2 ““ At the prompt type quit and then exit to get out from your root user account. Now you are in your user prompt ~$ (you are not a sudo administrator anymore) Close the Terminal by clicking on the X on the top of the screen partition color legend
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Lab 4 CST8101 – Computer Essentials ©Algonquin College March 24, 2024 Page 10 of 19 primary=Blue Extended=Yellow Logical=Pink Exercise 2: Creating and partitioning 2GB Hard drive (/Dev/ sdb In this exercise, you will create 2 primary , 1 extended , and 3 logical partitions in the /Dev/ sdb Turn on your clone partition again. Start the Terminal and switch to root user with the command: sudo -s – root When prompted enter your root password and hit enter , remember nothing will show on the screen when you type your password. ( Exam ) Create Primary partition in 2 GB partition: 1-Switch to the new hard drive by typing: fdisk /dev/ sdb 2-Press m to see the list of the letters (commands). Now choose P to see the number of partitions in the /dev/ sdb. You should see a 2 GB partition. 3-At the prompt Command press (m for help): n (to create a partition)
Lab 4 CST8101 – Computer Essentials ©Algonquin College of 19 4-Now on the Command prompt choose p (to choose a primary partition) and select the number 1 for the partition number. Accept the default for the first sector by pressing the Enter key. The size of the first primary partition is 500MB , so type +500M and press ente r Note: make sure you follow the below figure exactly Now press the the partition table. Now you will create the second primary partition in /dev/sdb Create another primary partition by selecting the n key, then select p for the primary partition and select the number 2 for the partition number. Accept the default for the first sector by pressing the Enter key. The size of the second primary partition is 200MB , so enter +200M and press the enter key. Create Extended partitions: Create an extended partition to host three logical drives - keep in mind that you must make it large enough to encapsulate the logical drive described below. HINT: There will be problems if you try to make it exactly 1000MB. So you will need to experiment; try entering 1005MB instead: 5-To create an extended partition press the n key, then select the e key for an extended partition. Select the number 3 for the partition number. Accept the default for the first sector by pressing the Enter key. Type + 1005M and press the enter key. Press the p key to display the two primary and one extended partition you just created in the partition table. Press enter Press enter
Lab 4 CST8101 – Computer Essentials ©Algonquin College March 24, 2024 Page 12 of 19 Create Logical partitions: 6-To create a logical partition inside of the extended partition press the n key and then select the L key for a logical drive. The size of the first logical partition should be 500 MB . Accept the default for the first sector by pressing the Enter key.so enter +500M and press the enter key. Press the p key to display the 2 primary , 1 extended , and 1 logical drive (500 MB) you just created. 7-To create a second logical drive in the extended partition press the n key and then select the L key for a logical drive. Accept the default for the first sector by pressing the Enter key. The size of the second logical drive should be 300MB , so enter +300M and press the enter key. Press the p key to display the 2 primary , 1 extended , and 2 logical partitions you just created. 8-To create a third logical drive in the extended partition press the n key and then select the L key for a logical drive. Accept the default for the first sector by pressing the Enter key. The size of the third logical drive should be 200MB so enter +200M and press the enter key . Note: You may get an error: value out of range depending on the size you made your extended partition. If you get an error, delete all logical and extended partitions only and recreate a bigger extended partition (1005M). If you did not get any error, then continue . Example of partitions Now press the p key to display all 2 primary , 1 extended , and 3 logical partitions you just created. Record the output by taking a screenshot using the Windows Snipping tool (snapshot) and put it here:
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Lab 4 CST8101 – Computer Essentials ©Algonquin College March 24, 2024 Page 13 of 19 Screenshot 3: showing all partitions (your name) (1 mark) Figure 3 ““ Exercise 3 : Changing Partition Types 1) You will notice all the partitions are of type Linux (83). We want to change the /dev/sdb7 Linux (the last logical) partition to a Linux Swap ( 82 ) partition. To change the partition to Linux Swap Partition press the t (change a partition type) key then enter 7 to select the 7 th partition . When prompted for the Hex code, enter 82 and hit the enter key. 82 is the hex code for a Linux Swap partition . If you want to see, the other codes available to you enter the l key when prompted for the hex code. 2) Press the p key to display the 2 primary, 1 extended 3 logical drives you just created. Record the output by taking a screenshot using the Windows Snipping tool and pasting it here:
Lab 4 CST8101 – Computer Essentials ©Algonquin College March 24, 2024 Page 14 of 19 Screenshot 4: changing partition7: (your name ) ( 1 mark ) Figure 4 ““ Questions (in Red) (3 mark) List all the primary partitions on the 2GB drive sdb1 – 500M , sdb2 – 200M List the extended partition on the 2GB drive sdb3 – 1005M List all logical drives on the 2GB drive sd5 – 500M , sd6 – 300M , sd7 – 200M Can you create additional primary partitions on the 2 Gb drive? Yes, or No, and Why? No Because we should start form the first step and the extended partition no allow me create a primary partition. Exercise 4: Deleting a Partition (logical) 1-We will be deleting the 300MB logical (/dev/sdb6) partition.
Lab 4 CST8101 – Computer Essentials ©Algonquin College To delete a partition, press the d key, you will be prompted for the partition number that you want to delete, press the 6 key, and hit the enter key as that is the partition that we wish to delete. 2-Press the p key to display the partition table. Record the output by taking a screenshot using the Windows Snipping tool and pasting it here: Snapshot 5: Deleting partition 6 (your name) ( 1 mark) Figure 5 ““ 3-What do you notice in terms of partition numbering? No Number : 4 4 -Save y our work to the hard disk by pressing the w key, this writes the partition table information to the hard disk Note: you may get a red warning failing to add partition 5 or 6 system: Device or resources busy. regarding the kernel is busy. Ignore it.
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Lab 4 CST8101 – Computer Essentials ©Algonquin College March 24, 2024 Page 16 of 19 5-Press the q key to quit fdisk program 6-Type exit to get out of the user root (administrator) 7-Reboot your Ubuntu. To see the saved partitions 8-Go back to the Terminal, change to the sudo user again and use fdisk /dev/ sdb 9-Choose p to see all partitions that you have created are saved Exercise 5: Changing sudo (root) password in Ubuntu By default in Ubuntu, the root password does not exist or set, therefore you must set the root password. Note: root user password is different from the user password. You should Save the root password somewhere safe. To set the root user password , in the terminal, type: Sudo passwd root press Enter if prompts you for your Linux password , this is the same password that you login to your Linux virtual machine ( user password )
Lab 4 CST8101 – Computer Essentials ©Algonquin College March 24, 2024 mike@m:~$ sudo passwd root [sudo] password for mike: pass (my user password to Linux) New password : mike ( root user password ) Retype new password : mike passwd : password updated successfully screenshot 6: sudo password renewed (your name) (1 mark) Figure 6 ““ To verify the root password : at the prompt type: su - root press Enter you will notice the prompt changes to # (sudo prompt) instead of $ (user prompt) To get out of sudo user prompt and go back to the user prompt, at the prompt type exit Exercise 6: Installing Tree application in Linux In the Linux environment, to install an application you must be a sudo user. Open the terminal, at the user prompt type: sudo apt-get install tree, and press Enter to provide the user password . Ubuntu begins to install the application Installing tree application:
Lab 4 CST8101 – Computer Essentials ©Algonquin College March 24, 2024 Page 18 of 19 To verify the tree application has been installed, at the prompt type: tree press Enter
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Lab 4 CST8101 – Computer Essentials ©Algonquin College March 24, 2024 Page 19 of 19 Screenshot 7: tree command (your name) (1 mark) You are done. Answer questions 3 screenshot 7 Total 10