0

how to know if some data already exist on device - disk

The simple way to check if disk include filesystem is to do:

 mount /grid/sdb /mnt

and if sdb or other /dev/sdx have file-system then mount will be succeeded, if not ... probably file system exists!

but this is ugly way to check that..

what the other elegant alternative to check file-system on disk?

my target is to check if file-system already configured on disk's as /dev/sdb - /dev/sdx

  • blkid / lsblk -f – Tom Yan Aug 10 '17 at 14:49
  • do you mean to do for example - blkid | grep sdx , and if it match then we know for sure that filesystem created ? ( can you please write your solution as well .......................... ) – King David Aug 10 '17 at 14:58
  • You don't need grep. You can pass a specific drive to either of the commands. – Tom Yan Aug 10 '17 at 14:59
  • you mean to run this - for example - blkid /dev/sdg – King David Aug 10 '17 at 15:02
  • in any case fs not created on disk it will give standard output diff from 0 – King David Aug 10 '17 at 15:04
0

You could use parted -l to list partitions (and filesystems). In case you are interested in damaged or partially wiped filesystems you can use recovery tools such as testdisk.

  • so I guess - you mean to run this - parted -l | grep "unrecognised disk label" and if filesystem not create it will bring the disk that match the - "unrecognised disk label" – King David Aug 10 '17 at 15:01
  • if you want only to see details for a single disk, you can use parted /dev/sdX print. – sebasth Aug 10 '17 at 15:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.