Filesystem Formatting and Checking

     Three basic toos are available to manage the filesystem on various partitions:fdisk,mkfs,and fsck.

They can help you configure partitions as well as create,and then check and repair,different filesystems.

fdisk:

     The Linux fdisk utility is a lot more versatile than its Microsoft counterpart.But to open it,you need know the device file associated with the hard drive that  you want change.Assuming you want to manage the partitions on the first SCSI hard disk,enter /sbin/fdisk /dev/sda.

mkfs:
     To format a Linux partition,apply the mkfs command.It allows you to format a partition to a number of different filesystems.

To format a typical partition such as /dev/hda2 to the current Red Hat standard,the thrd extended filesystem,run the following command:

     # mkfs -t ext3 /dev/hda2

     The mkfs command also serves as a "front-end" ,depending on the filesystem format.For example,if you're formatting a Red Hat standard ext3 filesystem,mkfs by itself automatically calls the mkfs.ext3 command.Therefore,if you're reformatting an ext3 filesystem,the following command is sufficient:

     # mkfs /dev/hda2

     Be careful with mkfs.First,back up any data on the subject partition and computer.This command erases all data on the specified partition.

fsck:

     The fsck command is analogous to the Microsoft chkdsk command.It performs an analysis of the specified filesystem and performs reparis as required.Assume you're having problems with files in the /var directory,which happens to be mounted on /dev/hda7.If you want to run fsck,unmount that filesystem first.In some cases,you may need to go into single-user mode with the init 1 command before you can unmount a filesystem.To unmount,analyze,then remount the filesystem noted in this section,run the following commands:

     # umount /var

     # fsck -t ext3 /dev/hda7

     # mount /dev/hda7 /var

The fsck command also serves as a "front-end",depending on the filesystem format.For example,if you're formatting an ext2 or ext3 filesystem,fsck by itself automatically calls the e2fsck command(which works for bothe filesystems).Therefore, if you're checking an ext3 filesystem,the following command is sufficient:

    # fsck /dev/hda7

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值