Formating Disk in Linux

Return to Lab 09

First Part: Disk formatting tutorial

  1. In each of your VM, please look at the device disk list.
    $ cat /proc/partitions|grep vd*

  2. Please save the output above in "hasil.txt" by using:
    $ cat /proc/partitions|grep vd >> hasil.txt
  3. vda, vdb, vdc, vdd, vde, and vdf 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.
  4. Block device's file is located in /dev. Please check for vda's file in /dev
    $ ls -lah /dev/vda*

  5. Please save the output into hasil.txt.
    $ ls -lah /dev/vda* >> hasil.txt
    
  6. Any partition which had been formatted should be mounted into a directory so it can be used.
    Use the following command to find out where /dev/vda1 is mounted.
    $ cat /proc/mounts | grep vda1
    

  7. Plase save the output into hasil.txt.
    $ cat /proc/mounts | grep vda1 >> hasil.txt
    
  8. Now create another disk from any other disk than vda. Each student should use different disk for their own task (please discuss it with your group). After doing so, follow next instructions and REPLACE any vdb with your own disk (vdb, vdc, vdd, vde, or vdf) in every commands.
  9. Use fdisk command to create new partition in your disk.
    $ sudo fdisk /dev/vdb
    


    TIP: If you need to cancel/quit from fdisk command, insert q.
  10. Create new primary partition by inserting n and then p into fdisk command.
  11. Insert default value for partition number, first sector, and last sector because we will turn the whole device into one partition.
  12. Check your partition status by inserting p.
    Then write your partition changes by inserting w.
  13. And then, format your newly created partition into using ext4 file system and add LATIHAN as disk label.
    $ sudo mkfs.ext4 -L LATIHAN /dev/vdb1
    

  14. Afterwards, please mount the partition and go to the partition in Terminal. Remember to replace vdb with your assigned disk.
    $ sudo mkdir /mnt/vdb1
    $ sudo mount /dev/vdb1 /mnt/vdb1
    
  15. Please download Tiny Core iso from Kambing into your new partition.
    $ wget http://kambing.ui.ac.id/tinycorelinux/4.x/x86/release/TinyCore-current.iso
    $ sudo cp TinyCore-current.iso /mnt/vdb1/
    
  16. Write the content of /mnt/vdb1 into hasil.txt. Remember to replace vdb with your assigned disk.
    $ ls -al /mnt/vdb1 >> hasil.txt
    $ sudo /sbin/blkid | grep /dev/vdb >> hasil.txt
    
  17. Please view the content of hasil.txt.
    $ cat hasil.txt
    
Second Part: Disk Formatting (Group Task)
  1. Make sure every person in your group already done the first part.
  2. Repeat previous steps to re-format one of any disk (vdb/vdc/vdd/vde/vdf). Please discuss it within your group.
    Change the output destination into hasil-tugas.txt instead of hasil.txt.
    As example, if you use vdb then re-format vdb into 2 partitions with these specifications.
    1. vdb1: type: primary, partition number: 1, size: 10M, file system: ext3, label: [GROUP_NAME].
    2. vdb2: type: primary, partition number: 2, size: 9.5M, file system: ext3, label: [CLASS]
      Replace [GROUP_NAME] with your group name and [CLASS] with your class code (e.g. A160).
  3. Bonus (5 points): format vdb2 with type: extended logical.

TIP: If you want to delete any partition, find help with m in fdisk command.

Return to Lab 09
Return to Wiki

format_disk_01.PNG (9.84 KB) Muhammad Iqbal muhammad.iqbal018, 08/05/2016 20:56

format_disk_02.PNG (10.8 KB) Muhammad Iqbal muhammad.iqbal018, 08/05/2016 20:56

format_disk_04.PNG (11.2 KB) Muhammad Iqbal muhammad.iqbal018, 08/05/2016 20:56

format_disk_03.PNG (6.64 KB) Muhammad Iqbal muhammad.iqbal018, 08/05/2016 20:56

format_disk_05.PNG (14.2 KB) Muhammad Iqbal muhammad.iqbal018, 08/05/2016 20:56

format_disk_06.PNG (20.1 KB) Muhammad Iqbal muhammad.iqbal018, 08/05/2016 20:56

format_disk_07.PNG (20.5 KB) Muhammad Iqbal muhammad.iqbal018, 08/05/2016 20:56

format_disk_08.PNG (20.4 KB) Muhammad Iqbal muhammad.iqbal018, 08/05/2016 20:56