0% found this document useful (0 votes)
6 views

Lecture-3.2_File Handling Utilities

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views

Lecture-3.2_File Handling Utilities

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 10

File Handling Utilities

Dr. Vimal Kr Baghel (Course Instructor), Assistant Professor


School of Computer Science Engineering & Technology (SCSET)
Bennett University Greater Noida
Outline
Operations for filesystem management

Creating partitions using fdisk

Formatting the partitions

Mounting the Filesystem

Checking and repairing the partitions

Q&A
Operations for Filesystem Management

Disk is partitioned to have a The partition can be an entire disk or its


filesystem on it. subset.

After partitioning, the partitions are formatted so that Linux can use
it

Checking and repairing a corrupted filesystem due to power


loss/application lookup and system conflict
Disk Partitioning using fdisk
• Creating disk partitions using
fdisk utility
• $ fdisk /dev/sdb
• Unable to open /dev/sdb
• $

• $ sudo fdisk /dev/sdb


• sudo] password for vimal:
• Device contains neither a valid DOS partition table,
• nor Sun, SGI or OSF disklabel
• Building a new DOS disklabel with disk identifier
0xd3f759b5.
• Changes will remain in memory only
• until you decide to write them.
• After that, of course, the previous content won't be
recoverable.
• Warning: invalid flag 0x0000 of partition table 4 will
• be corrected by w(rite)
• [...]
• Command (m for help):
Creating a Filesystem

Before you can store data on the partition, you must format it
with a filesystem so Linux can use it.

Each filesystem type uses its own command line program to


format partitions.
Creating a filesystem
• Formatting of filesystem partitions
Mounting the Filesystem

After you create the filesystem for a


partition, the next step is to mount it on
a virtual directory mount point so you
can store data in the new filesystem.

You can mount the new filesystem


anywhere in your virtual directory
where you need the extra space.
Checking and Repairing a Filesystem
The fsck command is used to check and repair most Linux filesystem types- ext, ext2, ext3, ext4, Reiser4,
JFS, and XFS.

The format of the command is:

• fsck options filesystem

Filesystems can be referenced using either the device name, the mount point in the virtual directory, or a
special Linux UUID value assigned to the filesystem.

The fsck command uses the /etc/fstab file to automatically determine the filesystem on a storage device
that’s normally mounted on the system.

If the storage device isn’t normally mounted (such as if you just created a filesystem on a new storage
device), you need to use the -t command line option to specify the filesystem type.
Checking and Repairing a Filesystem
Thanks
Q&A

You might also like