Module 3 - Partition and File System
Module 3 - Partition and File System
Module 3 - Partition and File System
Primary partitions: These are the main partitions on a disk and can be used to install an operating
system.
Extended partitions: These are partitions that are created within a primary partition and are used to
further divide disk space into logical partitions.
Root partition (“/”): This partition contains the core system files and directories.
Swap partition: This partition is used as virtual memory and helps improve system performance.
Q12: What are the commonly used standard partition types in Linux?
A12: The commonly used standard partition types in Linux are:
Primary Partition: The main partition that can contain a file system.
Extended Partition: A special partition that can hold multiple logical partitions within it.
Q13: How many primary partitions can you have on a single hard drive?
A13: You can have up to four primary partitions on a single hard drive. However, one of those partitions
can be an extended partition that can contain additional logical partitions.
GParted: A graphical partition editor that provides a user-friendly interface for managing partitions.
Q18: Can you resize or modify partitions in Linux without losing data?
A18: Yes, it is possible to resize or modify partitions in Linux without losing data, but it requires caution
and backup of important data. Tools like GParted provide options to resize, move, or create new
partitions while preserving existing data.
Create a mount point (an empty directory) where you want to access the partition.
Use the mount command with the appropriate options to mount the partition to the mount point.
The partition will be accessible through the mount point, and you can read from and write to it.
1. Open a terminal: Launch the terminal application on your Linux distribution. You can typically
find it in the system’s applications menu or by using the keyboard shortcut (e.g., Ctrl+Alt+T).
2. Identify the disk: Use the fdisk -l command to list the available disks and identify the one you
want to partition. Disks are usually named as /dev/sdX, where X represents a letter assigned to
each disk.
3. Launch the partitioning tool: Run the following command to launch the partitioning tool for the
chosen disk:
Replace /dev/sdX with the name of the disk you identified earlier.
4. Create a new partition: Once inside the fdisk tool, follow these steps:
5. Set the partition type: After creating the partition(s), you need to set the appropriate partition
type. This step determines the file system the partition will use. Follow these steps:
6. Write the changes: Once you have created and configured the partitions, write the changes on
the disk. To do this, follow these steps:
7. Format the partitions: After writing the changes, you need to format the partitions with the
desired file system. For example, to format a partition as ext4, you can use the following
command:
Sudo mkfs.ext4 /dev/sdX1
Question 22. What Is the Command to View All the Variables in Your System?
Answer : Set
Question 23. What Is the Command to View All the Kernel Parameters?
Answer : Sysctl -a
Question 24. What Is the Default Permission Applied to The User When You Mount a Nfs
Permission on Any Local Directory in Your System?
Answer : No user permission which is a system account in all the machines having normal user level
privileges unless no root squash or any other permission specification is not provided on the share.
Question 25. What Is the Difference Between Nfs Share and A Samba Share?
Answer : NFS sharing is done between linux to Linux where Samba sharing can be done between Linux-
Linux and Linux-windows.
Question 26. What Is the Command to Display All the Logical Volume Available in The
System?
Answer : Lvdisplay
Question 27. What Does the Last Two Sections Define in Fstab File?
Answer : The 5th column tells the dump information whether the partition must be backed up. If it is “0”
the filesystem will be ignored.
The 6th column tells the order in which the fsck command would check the filesystem on boot. If it is “0”
then fsck won’t check the filesystem.
Question 28. Explain The Procedure to Fix a Case When a System Is Unable to Boot Due to
Improper Entry in Fstab?
Answer : Boot into single user mode and make the necessary corrections inside fstab
Question 29. What Is the Default Mode When You Enter Single User Mode?
Answer : Read only for the first time but once you change it to read write then from next time onward it
will be read write.
Question 30. How Do You Make Permanent Changes to Any File Inside /proc Directory?
Answer : Sysctl -p
Question 32. What Is the Command to View All the Mounted Partitions on The System?
Answer : Mount
Question 33. What Is the Command to View All the Available Partitions on The System?
Answer : Fdisk -l
Question 34. What Is the Procedure You Follow to Extend a Lvm Partition?
Answer : Lvextend -L +1G /dev/VolGroup/LogVol1
Resize2fs /dev/VolGroup/LogVol1
Question 35. What Is a Swap Partition ? What Is the Recommended Swap Partition For 8 Gb
Ram?
Answer :
Swap partition is a feature used in Linux which uses the space allocated to it from the physical hard drive
and is utilized by te system when RAM memory goes full.
Question 36. What Is the Command Used to Check Any Hardware Changes Made on The
System in Linux?
Answer : Kudzu
Question 37. What Is the Difference Between Ext3 and Ext4 Filesystem?
Answer : Ext3
Ext4
Overall maximum ext4 file system size is 1 EB (exabyte). 1 EB = 1024 PB (petabyte). 1 PB = 1024 TB
(terabyte).
Question 45. When The System Runs the Fsck and Which Script Invokes It?
Answer :
When the system boots, the rc.sysinit script runs the fsck on any filesystems marked for checking in
/etc/fstab file. If any of these filesystems are markes as dirty or have data in the journal, fsck will
attempt to repair them. If it succeeds, the filesystems will be mounted and boot process continues, else
rc.sysinit will run sulogin and will report that fsck needs to be run manually.
Activate the swap file with swapon command (OR) initialize it in the startup.