How to check if a disk or partition has filesystem

This partition has an ext4 filesystem

file -s /dev/sda1
/dev/sda1: Linux rev 1.0 ext4 filesystem data (needs journal recovery) (extents) (huge files)

This device is a part of an LVM

file -s /dev/sdf
/dev/sdf: LVM2 (Linux Logical Volume Manager) , UUID: o67VcqRE41iVFAy0qlfP5cYefvFRt1H

This disk has a GRUB boot loader installed

file -s /dev/sda
/dev/sda: x86 boot sector; GRand Unified Bootloader, stage1 version 0x3, boot drive 0x80, 1st sector stage2 0x849fc, GRUB version 0.94; partition 1: ID=0x83, active, starthead 32, startsector 2048, 1024000 sectors; partition 2: ID=0x8e, starthead 221, startsector 1026048, 74471424 sectors, code offset 0x48

This disk has not been used

file -s /dev/sdh
/dev/sdh: data

This disk has been fully formatted without creating partition

file -s /dev/sdg
/dev/sdg: Linux rev 1.0 ext4 filesystem data (needs journal recovery) (extents) (large files) (huge files)
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s