查看Linux系统中所有设备,查看linux设备文件系统类型的几种方法

概述:在进行文件系统的相关测试或者操作的时候,往往需要知道文件系统的相关类型。在linux操作系统中,挂载是指将一个设备(通常是存储设备)挂接到一个已存在的目录上。我们要访问存储设备中的文件,必须将文件所在的分区挂载到一个已存在的目录上,然后通过访问这个目录来访问存储设备。在实际情况下,我们可能需要在设备挂载之前或者之后查看设备的文件系统类型。

1.mount命令

hyk@hyk-linux:~$mount

/dev/sda10on / type ext4 (rw,errors=remount-ro)

procon /proc type proc (rw,noexec,nosuid,nodev)

sysfson /sys type sysfs (rw,noexec,nosuid,nodev)

noneon /sys/fs/fuse/connections type fusectl (rw)

noneon /sys/kernel/debug type debugfs (rw)

noneon /sys/kernel/security type securityfs (rw)

udevon /dev type devtmpfs (rw,mode=0755)

devptson /dev/pts type devpts (rw,noexec,nosuid,gid=5,mode=0620)

tmpfson /run type tmpfs (rw,noexec,nosuid,size=10%,mode=0755)

noneon /run/lock type tmpfs (rw,noexec,nosuid,nodev,size=5242880)

noneon /run/shm type tmpfs (rw,nosuid,nodev)

/dev/sda3on /media/persondata type fuseblk(rw,nosuid,nodev,allow_other,blksize=4096)

/dev/sda2on /media/Cdisk type fuseblk(rw,nosuid,nodev,allow_other,blksize=4096)

gvfs-fuse-daemonon /home/hyk/.gvfs type fuse.gvfs-fuse-daemon(rw,nosuid,nodev,user=hyk)

说明:只能查看已经挂载的设备对应的文件系统类型

mount命令的一般形式为:mount-t type device dir

mount-l输出已经mount的各种设备的信息

2df -hT

hyk@hyk-linux:~$df -hT

Filesystem Type Size Used Avail Use% Mounted on

/dev/sda10 ext4 19G 6.8G 12G 38% /

udev devtmpfs 2.0G 4.0K 2.0G 1% /dev

tmpfs tmpfs 794M 924K 793M 1% /run

none tmpfs 5.0M 0 5.0M 0% /run/lock

none tmpfs 2.0G 684K 2.0G 1% /run/shm

/dev/sda3 fuseblk 51G 35G 17G 69% /media/persondata

/dev/sda2 fuseblk 49G 44G 5.1G 90% /media/Cdisk

说明:只能查看已经挂载的文件系统类型

df - report file system disk space usage

3.fdisk

hyk@hyk-linux:~$sudo fdisk /dev/sda

[sudo]password for hyk:

Thedevice presents a logical sector size that is smaller than

thephysical sector size. Aligning to a physical sector (or optimal

I/O)size boundary is recommended, or performance may be impacted.

Command(m for help): c

DOSCompatibility flag is set (DEPRECATED!)

Command(m for help): u

Changingdisplay/entry units to cylinders (DEPRECATED!)

Command(m for help): p

Disk/dev/sda: 750.2 GB, 750156374016 bytes

255heads, 63 sectors/track, 91201 cylinders

Units= cylinders of 16065 * 512 = 8225280 bytes

Sectorsize (logical/physical): 512 bytes / 4096 bytes

I/Osize (minimum/optimal): 4096 bytes / 4096 bytes

Diskidentifier: 0x06a30663

DeviceBoot Start End Blocks Id System

/dev/sda1 * 1 26 204800 7 HPFS/NTFS/exFAT

Partition1 does not end on cylinder boundary.

/dev/sda2 26 6400 51200000 7 HPFS/NTFS/exFAT

/dev/sda3 6400 13029 53249024 7 HPFS/NTFS/exFAT

/dev/sda4 13030 91202 627917825 f W95 Ext'd (LBA)

Partition4 does not start on physical sector boundary.

/dev/sda5 13030 28710 125952000 7 HPFS/NTFS/exFAT

/dev/sda6 28710 44390 125952000 7 HPFS/NTFS/exFAT

/dev/sda7 44390 64023 157696000 7 HPFS/NTFS/exFAT

/dev/sda8 64023 76527 100444160 7 HPFS/NTFS/exFAT

/dev/sda9 76528 77025 3998720 82 Linux swap / Solaris

/dev/sda10 77026 79515 19992576 83 Linux

/dev/sda11 79515 82125 20971520 83 Linux

说明:可以查看所有已经和没有挂载的设备

4.file命令:只能查看已经挂载的设备

hyk@hyk-linux:~$sudo file -s /dev/sda11

/dev/sda11:Linux rev 1.0 ext4 filesystem data,UUID=e88fadf8-f95b-4bff-976f-eba05b6c7a20 (needs journal recovery)(extents) (large files) (huge files)

5.parted:查看所有设备

hyk@hyk-linux:~$sudo parted

GNUParted 2.3

Using/dev/sda

Welcometo GNU Parted! Type 'help' to view a list of commands.

(parted)help

align-checkTYPE N check partition N for TYPE(min|opt)

alignment

checkNUMBER do a simple check on the filesystem

cp[FROM-DEVICE] FROM-NUMBER TO-NUMBER copy file system to anotherpartition

help[COMMAND] print general help, or help on

COMMAND

mklabel,mktableLABEL-TYPE create a new disklabel (partition

table)

mkfsNUMBER FS-TYPE make a FS-TYPE file system on

partitionNUMBER

mkpartPART-TYPE [FS-TYPE] START END make a partition

mkpartfsPART-TYPE FS-TYPE START END make a partition with a file system

moveNUMBER START END move partition NUMBER

nameNUMBER NAME name partition NUMBER as NAME

print[devices|free|list,all|NUMBER] display the partition table,

availabledevices, free space, all found partitions, or a particular

partition

quit exit program

rescueSTART END rescue a lost partition near START

andEND

resizeNUMBER START END resize partition NUMBER and itsfile

system

rmNUMBER delete partition NUMBER

selectDEVICE choose the device to edit

setNUMBER FLAG STATE change the FLAG on partitionNUMBER

toggle[NUMBER [FLAG]] toggle the state of FLAG onpartition

NUMBER

unitUNIT set the default unit to UNIT

version display the version number and

copyrightinformation of GNU Parted

(parted)p

Model:ATA WDC WD7500BPVT-2 (scsi)

Disk/dev/sda: 750GB

Sectorsize (logical/physical): 512B/4096B

PartitionTable: msdos

Number Start End Size Type File system Flags

1 1049kB 211MB 210MB primary ntfs boot

2 211MB 52.6GB 52.4GB primary ntfs

3 52.6GB 107GB 54.5GB primary ntfs

4 107GB 750GB 643GB extended lba

5 107GB 236GB 129GB logical ntfs

6 236GB 365GB 129GB logical ntfs

7 365GB 527GB 161GB logical ntfs

8 527GB 629GB 103GB logical ntfs

9 629GB 634GB 4095MB logical linux-swap(v1)

10 634GB 654GB 20.5GB logical ext4

11 654GB 676GB 21.5GB logical ext4

6.fstab

hyk@hyk-linux:~$less /etc/fstab

  • 0
    点赞
  • 0
    收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
©️2022 CSDN 皮肤主题:游动-白 设计师:我叫白小胖 返回首页
评论
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值