You are on page 1of 7

Partition & File System

Q1: What is a partition in Linux?


A1: In Linux, a partition is a logical division of a physical disk drive. It allows you to separate and organize
data, as well as install different operating systems on a single disk.

Q2: How many types of partitions are there in Linux?


A2: In Linux, there are primarily two types of partitions:

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.

Q3: What is the purpose of a partition table in Linux?


A3: A partition table is a data structure stored on a disk that contains information about the partitions
present on the disk. It helps the operating system locate and access the data stored on different
partitions.

Q4: How can you create a partition in Linux?


A4: There are several tools available in Linux to create partitions, such as fdisk, parted, and gparted.
These tools allow you to create, delete, and modify partitions on a disk.

Q5: What is the recommended partition scheme for Linux?


A5: The recommended partition scheme for Linux typically includes at least two 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.

Q6: How can you view the existing partitions in Linux?


A6: You can use the fdisk -l command to view the existing partitions on a disk in Linux. This command
displays the partition table information, including the type, size, and filesystem of each partition.

Q7: Can you resize a partition in Linux?


A7: Yes, it is possible to resize a partition in Linux. Tools like fdisk, parted, and gparted provide options
to resize partitions while preserving the data stored on them. However, it is recommended to back up
important data before resizing partitions.
Q8: What is the mount point in Linux?
A8: A mount point is a directory in the Linux file system where a partition or a storage device is attached.
When a partition is mounted at a specific mount point, the files and directories on that partition become
accessible at that location in the file system hierarchy.

Q9: How can you mount a partition in Linux?


A9: To mount a partition in Linux, you can use the mount command followed by the device name and
the mount point. For example, to mount a partition /dev/sdb1 at the mount point /mnt/data, you can
use the command: mount /dev/sdb1 /mnt/data.

Q10: What is the purpose of the /etc/fstab file in Linux?


A10: The /etc/fstab file is a configuration file in Linux that contains information about the file systems
and partitions to be mounted at boot time. It specifies the device, mount point, filesystem type, and
other mount options for each partition.

Q11: What is standard partitioning in Linux?


A11: Standard partitioning in Linux refers to the practice of dividing a hard drive into separate sections
or partitions, each with its own file system, to store data and system files independently.

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.

Logical Partition: Partitions created within an extended partition.

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.

Q14: What is the purpose of an extended partition in Linux?


A14: An extended partition serves as a container for logical partitions. It allows you to create more than
four partitions on a disk by dividing the available space within the extended partition into logical
partitions.

Q15: How is the partition layout represented in Linux?


A15: The partition layout is represented using the partition table, which is stored in the Master Boot
Record (MBR) or the newer GUID Partition Table (GPT) format. The partition table contains information
about the size, type, and location of each partition on the disk.
Q16: How can you create and manage partitions in Linux?
A16: Partitioning in Linux can be done using various tools such as:

Fdisk: A command-line tool for partition table manipulation.

Parted: A command-line utility with more advanced partitioning options.

GParted: A graphical partition editor that provides a user-friendly interface for managing partitions.

Q17: What is the significance of the root partition (/) in Linux?


A17: The root partition (/) is the top-level directory in the file system hierarchy. It contains all the files
and directories necessary for the system to function. It is typically mounted as read-only during system
startup and can be remounted as read-write when necessary.

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.

Q19: How can you mount a partition in Linux?


A19: To mount a partition in Linux, you need to follow these steps:

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.

Q20: What is the purpose of the swap partition in Linux?


A20: The swap partition in Linux is used as virtual memory when the physical RAM is full. It allows the
system to temporarily store inactive data and swap it in and out of the RAM as needed. The swap
partition helps prevent system slowdowns or crashes due to memory exhaustion.

Q21: How can we create standard partition step by step in linux?


A21:

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:

Sudo fdisk /dev/sdX

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:

Press n to create a new partition.


Choose the partition type (primary or extended). For a standard partition, select primary.
Specify the partition number (e.g., 1 for the first partition).
Set the starting and ending sectors for the partition. You can either specify the exact size in
sectors or use relative values (e.g., +2G for a 2GB partition).
Optionally, repeat the process to create additional partitions.

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:

Press t to change the partition’s type.


Enter the partition number for the partition you want to modify.
Specify the code for the desired file system. For example, 83 for Linux ext4, 82 for Linux swap, or
b for FAT32.

6. Write the changes: Once you have created and configured the partitions, write the changes on
the disk. To do this, follow these steps:

Press w to write the partition table and exit.


Confirm the action by typing yes or y.

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

Replace /dev/sdX1 with the appropriate partition name.

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 31. What Is the Use of Mtab Directory?


Answer : It contains a list of all the mounted directories or partitions on the system.

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

This will extend the partition size by +1 GB.

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.

Amount of RAM in the System Recommended Amount of Swap Space

4GB of RAM or less a minimum of 2GB of swap space

4GB to 16GB of RAM a minimum of 4GB of swap space

16GB to 64GB of RAM a minimum of 8GB of swap space

64GB to 256GB of RAM a minimum of 16GB of swap space

256GB to 512GB of RAM a minimum of 32GB of swap space

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

Maximum individual file size can be from 16 GB to 2 TB

Overall ext3 file system size can be from 2 TB to 32 TB

Ext4

Maximum individual file size can be from 16 GB to 16 TB

Overall maximum ext4 file system size is 1 EB (exabyte). 1 EB = 1024 PB (petabyte). 1 PB = 1024 TB
(terabyte).

Question 38. What Is the Filesystem Used in Rhel 5 And Rhel 6?


Answer : Ext3 for RHEL 5 and ext4 for RHEL 6.

Question 39. What Is the Function of Resize2fs Command?


Answer : This can be used to change the size of an ext2 or ext3 filesystem.
Question 40. What Is the Function of Debugfs Command?
Answer : This utility is used to examine and debug an ext2 filesystem. This can also be used to manually
verify the inode integrity and an aid to recover data.

Question 41. What Is the Function of Dump2fs Command?


Answer : Provides a dump of file system information to standard out (Console). Can be redirected to a
file.

Question 42. What Is the Function of Tune2fs Command?


Answer : This is used to modify the filesystem attributes (Like converting ext2 to ext3).

Question 43. Types Of Journals and Their Function?


Answer :

Ordered : This is the default and journal only meta-data

Journaled : Journals data and meta-data

Writeback : Journal updates are not atomic.

Question 44. What Is E2fsck Command?


Answer : Fsck is a front-end tool for e2fsck.

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.

Question 46. Why Fsck Used?


Answer : Fsck (file system check) is used to maintain file system consistency.

Question 47. How To Create a Swap File?


Answer :

Create a file as:

# dd if=/dev/zero of=swapfile bs=512 count=N

(Where N is the file size in KB)

Run the mkswap to create signature.

Activate the swap file with swapon command (OR) initialize it in the startup.

You might also like