您的位置:首页 > 运维架构 > Linux

查看linux分区文件系统类型

2010-09-15 16:40 841 查看

以往我们拿到一块朋友的硬盘没有办法看是什么分区,导致mount命令不能识别分区类型,现在好了。

fdisk -l不复杂,但是看不到文件系统类型,只能看到分区类型,以Redhat 9为例:

[root@redhat9 root]# fdisk -l

Disk /dev/sda: 8589 MB, 8589934592 bytes
255 heads, 63 sectors/track, 1044 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/sda1 * 1 13 104391 83 Linux
/dev/sda2 14 1012 8024467+ 83 Linux
/dev/sda3 1013 1044 257040 82 Linux swap

df -Tk是可以的,不过df -Th更友好一些,容量大小是以易读的方式显示的,而且它是显示所有分区,并不是一个分区。这个命令最方便。

[root@redhat9 root]# df -Th
Filesystem Type Size Used Avail Use% Mounted on
/dev/sda2 ext3 7.6G 2.3G 4.9G 32% /
/dev/sda1 ext3 99M 9.3M 85M 10% /boot
none tmpfs 62M 0 62M 0% /dev/shm

parted倒是有点复杂了,因为它的功能很强,redhat 9中的parted不支持-p参数,但是用parted命令进入后可以用p命令显示出当前的磁盘分区和文件系统情况:

# parted
GNU Parted 1.6.3
Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
This program is free software, covered by the GNU General Public License.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.

Using /dev/sda
Information: The operating system thinks the geometry on /dev/sda is 1044/255/63. Therefore,
cylinder 1024 ends at 8032.499M.
(parted) p

Disk geometry for /dev/sda: 0.000-8192.000 megabytes
Disk label type: msdos
Minor Start End Type Filesystem Flags
1 0.031 101.975 primary ext3 boot
2 101.975 7938.369 primary ext3
3 7938.369 8189.384 primary linux-swap
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: