在linux下怎样查看文件分区类型?
可以想象到肯定是使用和分区有关的命令和文件才能实现,我尝试了一下有如下几种(如果有什么不对和需要补充的请给我留言):
1.使用fdisk命令
fdisk /dev/hda
进入fdisk的命令模式,你可以键入m来查看帮助信息
键入p就可以查看hda这个设备的所有分区的文件类型了。
可以键入q来退出fdisk的命令模式
2.使用parted命令
fdisk命令我们经常看到,但是这个命令我们却使用的很少(可能是我自己见识太少了;-)),其实这个命令也是挺强大的,基本上fdisk可以做的parted都可以做到。
parted /dev/hda
进入parted的命令模式,你可以键入help来查看帮助信息。
键入print就可以查看hda这个设备的所有分区的文件类型了。
可以键入quit来退出parted的命令模式
下面是man parted的介绍
PARTED(8) GNU Parted Manual PARTED(8)
NAME
GNU Parted - a partition manipulation program
SYNOPSIS
parted [options] [device [command [options...]...]]
DESCRIPTION
This manual page documents briefly the parted command. Complete docu-
mentation is distributed with the package in GNU Info format; see
below.
parted is a disk partitioning and partition resizing program. It
allows you to create, destroy, resize, move and copy ext2, ext3, linux-
swap, FAT and FAT32 partitions. This is useful for creating space for
new operating systems, reorganising disk usage, and copying data to new
hard disks.
OPTIONS
-h, --help
displays a help message.
-i, --interactive
where necessary, prompts for user intervention.
-s, --script
never prompts for user intervention.
-v, --version
displays the version.
COMMANDS
[device]
The block device to partition.
[command [options]]
Specifies a command to parted. If no command is given, parted
will give you a command prompt. Commands are:
check partition
does a simple check on partition.
cp [source-device] source dest
copies the source partition鈙 filesystem on source-device
(or the current device if no other device was specified)
to the dest partition on the current device.
help [command]
prints general help, or help on command if specified.
mkfs partition fs-type
make a filesystem fs-type on partition. fs-type can be
one of "FAT", "ext2" or "linux-swap".
mklabel label-type
Creates a new disklabel (partition table) of label-type.
label-type should be one of "bsd", "gpt", "loop", "mac",
"mips", "msdos", "pc98" or "sun".
mkpart part-type [fs-type] start end
make a part-type partition with filesystem fs-type (if
specified), beginning at start and ending at end (in
megabytes). part-type should be one of "primary", "logi-
cal" or "extended"
mkpartfs part-type fs-type start end
make a part-type partition with filesystem fs-type begin-
ning at start and ending at end (in megabytes)
move partition start end
move partition to start at start and end at end. Note:
move never changes the minor number
name partition name
set the name of partition to name. This option works only
on Mac and PC98 disklabels. The name can be placed in
quotes, if necessary
print displays the partition table
quit exits parted
resize partition start end
resize the filesystem on partition to start at start and
end at end megabytes
rm partition
deletes partition
select device
choose device as the current device to edit. device
should usually be a Linux hard disk device, but it can be
a partition, software raid device or a LVM logical volume
if that is necessary
set partition flag state
change the state of the flag on partition to state. Flags
supported are: "boot", "root", "swap", "hidden", "raid",
"lvm" and "lba". state should be either "on" or "off"
REPORTING BUGS
Report bugs to
SEE ALSO
fdisk(8), mkfs(8), The parted program is documented fully in the GNU
partitioning software manual available via the Info system.
AUTHOR
This manual page was written by Timshel Knoll , for
the Debian GNU/Linux system (but may be used by others).
3.使用mount命令
mount一般用来挂载分区的,其实它也可以用来查看分区类型的。
mount --guess-fstype /dev/hda1
但是这个每次只能查看一个分区
4.使用df命令
df本身就是用来查看分区信息的,但是如果你不加上参数,它是不会列出分区类型的。
df -T
加上-T这个参数,就可以列出所有系统挂载的分区的文件类型信息了
5.查看配置文件
当然你可通过查看配置文件来知道分区的文件类型。
cat /etc/fstab
阅读(790) | 评论(0) | 转发(0) |