2014-04-15 1 views

답변

4

psutil는 크로스 플랫폼 패키지 인 identify partition types 할 수 있습니다

>>> psutil.disk_partitions() 
[sdiskpart(device='/dev/sda1', mountpoint='/', fstype='ext4', opts='rw,nosuid'), 
sdiskpart(device='/dev/sda2', mountpoint='/home', fstype='ext4', opts='rw')] 

경고 : 리눅스에서 fstype이다가 ext4 또는 ntfs로보고 될 수 있지만, Windows에서, fstype이다가 "removable", "fixed", "remote", "cdrom", "unmounted" or "ramdisk"로 제한됩니다.

+0

굉장합니다. 감사. 특정 디렉토리의 파일 시스템을 찾는 방법이 있다면 대답에 큰 도움이 될 것입니다. 아무리해도 도움이됩니다. – Shule

+2

Linux에서'df -TP path'의 출력물을 파싱 할 수는 있지만 장치 이름과 마운트 지점에 공백이 포함될 수 있으므로 매우 까다로울 수 있습니다. – unutbu

+0

이제 Windows에서 실제 fstype을 얻을 수 있으므로 이전 경고가 이제 '유효하지 않음'이됩니다. 나는 그것이 작동하는지 확인할 수 있지만, psutil에 대한 커밋 메시지도보실 수 있습니다 : https://github.com/giampaolo/psutil/issues/209#issuecomment-44019539 – Patrick

관련 문제