Format Hard Disk (revisi 141117-r01KI)¶
First Part: Make a partition and disk formatting tutorial
- Tiny Core Ova which is used for this class has 5 hard disks that can be seen at Virtual Box setting. However, we currently use only one partition. In this lab, we will study the commands that are useful for hard disk operation.
- When you open Tiny Core, you can access another hard disk partition by mounting it. But for this time if you mount another partition, you will just see one hard disk partition because another virtual hard disks do not have file system yet.
- Please look at the device disk list in Tiny Core by using command : cat /proc/partitions|grep sd. You will see the output similar with the following picture. The five virtual hard disks are sda, sdb, sdc, and sdd.
- Please save the output above in "hasil.txt" by using:
$cat /proc/partitions|grep sd > hasil.txt
- sda,*sdb*, sdc, sdd, and sde are well known as block device file. Those file are representation of I/O devices such as hard disk, flash disk, memory card, and CD/DVD ROM. Those devices write the data in block in hard disk. Block is byte sequence with a particular size like 512 bytes or 4 kilobytes.
- Block device's file is located in /dev. Please cek for sda's file in /dev with command ls -lah /dev/sda. You will see:
- Please save the output into "hasil.txt".
$ls -lah /dev/sda* >> hasil.txt
- Please look at the step 6. You will not only see /dev/sda in the output but also /dev/sda1 - /dev/sda9. From that we can say that Tiny Core support the creation of 9 partition in one disk. Partition is a method for divide the hard disk's space. We can format the disk partition with a file system.
- A new formatted partition must be mounted before it can be used. Please use the command /dev/sda1 to show the partition mount point.
$cat /proc/mounts | grep sda1
- From the command above, we will get the output similar with the following picture below. We can see that /dev/sda1 is mounted to /mnt/sda1's directory.
- Please save the output into "hasil.txt"
$cat /proc/mounts | grep sda1 >> hasil.txt
- Now, we using sdb device to make a partition. Please use command sudo fdisk /dev/sdb so that you can entry the fdisk console.
TIPS: If you get wrong in the previous step, please use command "q" to cancel the process.
- Please make a new partition which is "primary partition" by sung command "n" then p at the fdisk console.
- Please put 1 for partition number and first cylinder. Please put your own size for last cylinder. For this tutorial we will use the whole disk intu one partition so please put +2140M for last cylinder. Press enter button after answer the last question.
- Please check your partition by typing p to fdisk console. You will get the output similar witj picture below. The partition with name /dev/sdb1 has been created in /dev/sdb. After that, please write your change by using command w.
- Please format your new partition by using file system ext4 and change the name with LATIHAN. You can use the following command:
$sudo mkfs.ext4 -L LATIHAN /dev/sdb1
- Please wait until the process is finish.
- Please try to mount your new formatted hard disk.
$sudo mkdir /mnt/sdb1 $sudo mount /dev/sdb1 /mnt/sdb1
Command above is use for access Mount Tool, then please click sdb1 (unmounted)
so that it change into green.
- Please go to /mnt/sdb1. Download the following file into your new partition.
$ cd $ wget http://kambing.ui.ac.id/tinycorelinux/4.x/x86/release/TinyCore-current.iso $ sudo cp TinyCore-current.iso /mnt/sdb1/ $ cd /mnt/sdb1
- Please do the command below to save the data and the result into sdb1
$ ls -al >> /home/tc/[KELAS]/[NPM]/Lab09/hasil.txt $ sudo /sbin/blkid | grep /dev/sdb >> /home/tc/[KELAS]/[NPM]/Lab09/hasil.txt
- Please look the content of "hasil.txt".
$ cd /home/tc/[KELAS]/[NPM]/Lab09 $ cat hasil.txt
Second Part: Assignment¶
- Please repeat the steps 12-20 above to process sdc device. You must create two partition with specification as following:
- sdc1: type: primary, partition number: 1, size: cylinder 1-130, file system: ext3, name: your student ID,
- sdc2: type: primary, partition number: 2, size: cylinder 132-261, file system: ext3, name: your TOKEN,
BONUS: You will gain 5% bonus if you make sdc2 partition with extended logical type.