How to see which drive a file is on

trying to manage files and backups
When I look at the file locations, the drive seems to be missing from the location shown.

How do we see where the file location is? (Without missing parts of the location, especially the base of it)

There is no such thing as a drive.

You have a location where the partition has been mounted - if it is automounted the location is

/run/media/$USER/some-name-or-uuid

Example is one of my usb

/run/media/fh/WDUSB-ISO/

If I list the content

 $ ls /run/media/fh/WDUSB-ISO/
angler-opm7.181205.001-factory-b75ce068.zip
archlinux-x86_64.bak.iso
archlinux-x86_64.iso
EndeavourOS_Cassini_neo_22_12.iso
en-us_windows_10_enterprise_ltsc_2021_x64_dvd_d289cf96.DpdLmrgO.iso.part
en-us_windows_10_enterprise_ltsc_2021_x64_dvd_d289cf96.iso
FreeBSD-13.1-RELEASE-amd64-dvd1.iso
GhostBSD-22.06.18.iso
HBCD_PE_x64.iso
manjaro-kde-22.0-minimal-221224-linux61.iso
pclinuxos64-kde-2022.12.iso
pclinuxos64-kde-darkstar-2022.12.30.iso
Qubes-R4.1.1-x86_64.iso
siduction-22.1-Masters_of_War-kde-amd64-202212291659.iso
systemrescue-9.06-amd64.iso
w10decrap.ps1
Win10_21H2_Danish_x64.iso
Win10_22H2_EnglishInternational_x64.iso
Win2019_x64.iso
wonky-vm.ova

The location is a tree with branches and leaves - actually - the package tree contains a command to visualize the content of the system tree

This is just one level

 $ tree / -L 1
/
├── a
├── bin -> usr/bin
├── boot
├── dev
├── etc
├── home
├── lib -> usr/lib
├── lib64 -> usr/lib
├── lost+found
├── mnt
├── opt
├── proc
├── root
├── run
├── sbin -> usr/bin
├── srv
├── sys
├── tmp
├── usr
└── var

Let’s take a branch

 $ tree /usr -L 1
/usr
├── bin
├── include
├── lib
├── lib32
├── lib64 -> lib
├── local
├── sbin -> bin
├── share
└── src

Or a home folder - not a common layout - I admit that

 $ tree /home -L 2
/home
└── fh
    ├── Desktop
    ├── Documents -> /a/private/.home/Documents
    ├── Downloads -> /a/private/.home/Downloads
    ├── Music -> /a/private/.home/Music
    ├── Pictures -> /a/private/.home/Pictures
    ├── Postman -> /a/private/.home/Postman
    ├── Public -> /a/private/.home/Public
    ├── Templates -> /a/private/.home/Templates
    ├── Videos -> /a/private/.home/Videos
    └── VirtualBox VMs -> /a/virtualbox
  • / - where everything starts
  • /home/user - is a user’s home folder
  • /run/media - is a volatile structure which only exist at runtime
  • /run/media/user/some-uuid-or-name - is a partition mounted automagically by the system

Mounts can also be defined to be static - in which case the file /etc/fstab or a mount unit is used for defining What, Where and How a partition is mounted.

2 Likes

Hi @Try042bcbbf9b130bef,

As @linux-aarhus said, in/with Linux there is no such things ass drives. You’ll have to know which partition is mounted where, and from that you can deduce on which partition and then drive it is. See below for more:

1 Like

hi

command df or lsblk is useful for you ?

where ? dolphin , terminal command, application ?

2 Likes

Dolphin, and file properties in dolphin
(Why is there a ~ in the dolphin listing, but not in the properties listing?)

The tilde is a shortname for the logged in user’s home It only works for the currently logged in user e.g. the following is a reference to the same file

  • /home/$USER/.bashrc
  • ~/.bashrc

the dot (.) is signaling a hidden file - that is - it will not be shown unless you tell Dolphin to show them - use Ctrlh to toggle.

Tryout

cat /home/$USER/.bashrc

Then

cat ~/.bashrc
1 Like

where is my ~ (home) ?

echo $HOME

same results for:

ls -ld $HOME
ls -ld ~
ls -ld /home/$USER
1 Like

Thats interesting to know, but I am very puzzled by why they dont match.
Its the exact same file, it would make sense that it would be showing the exact same location.

Is this schroedingers file?

~ is shorthand, a shortcut, ehateverryoucall it to $HOME, which is, in turn, a shortvut/shorthand/variable/whateverit’scalled to `/home/<username``, your home, personal, directory…

Edit:

My mistake. Both point to your home directory:

$ echo ~                                                                                                                                                                                                                                             
/home/mirdarthos

$ echo $HOME
/home/mirdarthos

Ok so , if I have some files on save SDA2
and I want to copy them to NVME

How would that be done?

I look at my root properties, an it says its nvme, and my files I want to copy are on root in SDA2 (I think) , how can someone move them from SDA2 to NVME?

Alternatively, how could I overwrite the faulty OS files on SDA2 with the working OS files in NVME, and boot my system files normally?

Thats really a different question than posed here … though you could employ some of the things mentioned, like df and ls to look at things.

As others said, use df to get under which mount point the folder is, e.g.

df -h --all /home/$USER
Filesystem      Size  Used Avail Use% Mounted on
/dev/nvme0n1p2  500G  100G  400G  20% /

For your partition (e.g. sda2) find if it’s mounted

mount | grep -i "sda2"
/dev/sda2 on /mnt/smth

If not you’ll need to mount it using sudo mount