I need to find the best approach that search the unused disk in my linux OS
for example from the following ouput we can see that sde is not mounted and seems to be free disk ( we need free disk in order to create on him FS and then mount to some folder )
please advice what is the best approach to find the free disk ? with command line or command line with awk / sed / perl etc , in order to capture the unused disk
sda is for the OS
lsblk | grep disk | grep -v fd0
sda 8:0 0 150G 0 disk
sdb 8:16 0 20G 0 disk /jeded
sdc 8:32 0 20G 0 disk /var/mmn
sdd 8:48 0 20G 0 disk /var/nrdd
sde 8:64 0 20G 0 disk
expected output should be sde
- there are some other command to view the disk as sfdisk -s , or fdisk -l , but what we want to find is which disk is a free disk ( without FS / mounted )
/
to indicate not-free disk, trylsblk | awk '/disk/ && !/fd0|^sda |\//{print $1}'
– Sundeep Jul 25 '17 at 15:31