-1

How can I find the name of the hard disk I'm already in as I tried

sudo fdisk -l

but the result contains a lot of names, i just need the hard disk I'm using now , please

EDIT

I got

sda      8:0    0   1.8T  0 disk 
├─sda1   8:1    0   487M  0 part /boot/efi
└─sda2   8:2    0   1.8T  0 part /
sdb      8:16   0   3.7T  0 disk 
└─sdb1   8:17   0   3.7T  0 part /data
5
  • What do you mean by "the hard disk I am using"? Depending on what you are doing, the answer could be different. May 12, 2022 at 19:47
  • i'm using a computer remotely but i don't know which drive I'm using i just create an account and using it remotely
    – sammo
    May 12, 2022 at 19:50
  • 1
    It depends on what you strictly mean with name and in. Some commands to get info about "first disk" is sudo hdparm -I /dev/sda, udevadm info --query=all --name=/dev/sda or inxi --disk-full. Seems an XY problem, why do you need this info? You already know all this? May 12, 2022 at 19:53
  • i need to recover the files i deleted from the trash and I'm using the computer remotely. so i need to specify which drive i need to check or recover it
    – sammo
    May 12, 2022 at 19:54
  • I like Gnome Disks which comes with Ubuntu. May 12, 2022 at 23:05

1 Answer 1

0

"The harddisk I'm using now" might depend on which folder you are in, even $HOME might be on a separate disk from /, entrily dependent on how the disk was set up.

Does this answer your question?

$ lsblk 
NAME        MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sda           8:0    0 931,5G  0 disk 
└─sda1        8:1    0 931,5G  0 part 
sdb           8:16   0 465,8G  0 disk 
...

This might pinpoint what you're after, one line selected from above.

$ lsblk | grep ' /$'

Another peek:ing to do

$ ls -l /dev/disk/by*
... (loads of text)
10
  • Thanks please can you see the edit post , i posted the result i got but i couldn't identify which hard disk I'm using now
    – sammo
    May 12, 2022 at 19:41
  • add the output of $ pwd and compare the results,
    – Hannu
    May 12, 2022 at 19:42
  • Most likely /dev/sda if you have not done cd /Data or similar
    – Hannu
    May 12, 2022 at 19:43
  • i got from pwd /home/sam/
    – sammo
    May 12, 2022 at 19:43
  • 1
    yes, The disk is /dev/sda and the second partition, so /dev/sda2
    – Hannu
    May 12, 2022 at 19:47

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .