Ask Your Question

How to find out whether or not a file/directory resides on SSD or HDD?

asked 2017-08-08 15:09:30 -0500

aminsadeghi gravatar image

I just installed Fedora on my office workstation, which has a 256 GB SSD and a 1 TB HDD. During the installation, I chose both partitions, and as a result, Fedora somehow combined my two partitions into one, and currently, I can't distinguish which files are on which partition. Ideally, I want my programs to be installed on the SSD and other static data such as my Dropbox folder to reside on the HDD. My question is how can I distinguish which files/directories reside in which partition.

edit retag flag offensive close merge delete


Welcome to ask.fedora. From what you write, you used the default partitioning, which combined both of your drives into one logical volume, using LVM. You may be able to get things the way you want without backing up your data and reinstalling, but we need more data. Please run sudo fdisk -l in a terminal (That's a lower case L, not a 1.) and add it to your question so that we can see just what's going on.

sideburns gravatar imagesideburns ( 2017-08-08 19:08:39 -0500 )edit

3 Answers

Sort by ยป oldest newest most voted

answered 2017-11-15 08:23:05 -0500

blorg gravatar image

I'll give you some stuff to start with, but I'd really recommend you go read up on Linux LVM (Logical Volume Manager) and how this all ties together. A Beginner's Guide to LVM is a good place to start.

Some basic terms:

PV - Physical Volume - The actual physical drives themselves VG - Volume Group - a group of PVs linked together to act like a single disk LV - Logical Volume - a slice of a VG

One one of my boxes at home, I have a 256 gig SSD, 2 2TB spinning disks and a 4 TB spinning disk. The SSD is a single PV VG with 1 LV on it that has the base OS bits on it, the spinning disks are all in another VG with currently two separate LVs.

$ sudo pvscan    # scan physical volumes
  PV /dev/sdb1   VG ccmd_home       lvm2 [1.82 TiB / 0    free]
  PV /dev/sdc1   VG ccmd_home       lvm2 [1.82 TiB / 0    free]
  PV /dev/sdd    VG ccmd_home       lvm2 [3.64 TiB / 3.29 TiB free]
  PV /dev/sda2   VG fedora-server   lvm2 [232.39 GiB / 0    free]
  Total: 4 [7.50 TiB] / in use: 4 [7.50 TiB] / in no VG: 0 [0   ]

$ sudo vgscan    # scan volume groups
  Reading volume groups from cache.
  Found volume group "ccmd_home" using metadata type lvm2
  Found volume group "fedora-server" using metadata type lvm2

$ sudo lvscan    # scan logical volumes
  ACTIVE            '/dev/ccmd_home/home' [1.00 TiB] inherit
  ACTIVE            '/dev/ccmd_home/tres' [2.99 TiB] inherit
  ACTIVE            '/dev/fedora-server/swap' [15.62 GiB] inherit
  ACTIVE            '/dev/fedora-server/root' [216.77 GiB] inherit

So, let's say I wanted to remove one of those 2TB disks and use it for something else.

First, I'd need to see if I have free space to do so. We can see that in the 'ccmd_home' VG, I have two LVs defined, using a total of 4 TB of the 8 TB in the VG (using rounded numbers). I have enough free space to remove a PV from the VG.

Now, I need to see if that disk has data on it. From the 'pvscan' output above, it looks like it probably does, but to double-verify, we can use 'pvdisplay':

sudo pvdisplay /dev/sdb1
  --- Physical volume ---
  PV Name               /dev/sdb1
  VG Name               ccmd_home
  PV Size               1.82 TiB / not usable 4.09 MiB
  Allocatable           yes (but full)
  PE Size               4.00 MiB
  Total PE              476931
  Free PE               0
  Allocated PE          476931
  PV UUID               b1YmnD-TLEH-ZHvM-JoYR-cze2-gYqD-4TSZfz

Presumably, I want to keep that data, so I need to move it. I have two options here, both using the 'pvmove' command. I can use pvmove /dev/sdb1 and let the system find (available) free space, or I can specify a destination explicitly with pvmove /dev/sdb1 /dev/sdd since I know that /dev/sdd is in the VG and has free space. If you're not sure, use the first one. This can take a while, depending on how much data is on the disk.

Once the data ... (more)

edit flag offensive delete link more

answered 2017-08-10 10:01:56 -0500

blorg gravatar image

What probably happened is that the installer stuck both drives into a single LVM volume.

If you want things separate, you're going to have to shrink your filesystems so that everything fits on the SSD, then run some LVM commands to remove the 1TB drive from the VG, create a new VG with just the HDD in it, and mount it on a temporary mount (like /temphome), copy your data from /home to /newhome, delete the data from /home after you've verified you've got everything, unmount /newhome and re-mount it as /home, fixing up your /etc/fstab to make sure everything comes back up properly after a reboot.

There are Linux LVM tutorials out there, and it's not really all that complicated of a task, you just have to not be afraid of the command line.

edit flag offensive delete link more


Thank you for your answer. Can you please elaborate on your answer? I'm not familiar with partitioning. If you could be more detailed on the steps I need to take.

aminsadeghi gravatar imageaminsadeghi ( 2017-08-15 10:13:08 -0500 )edit

I started to answer this in the comments, but we're limited to how much I can type as a comment, so, I made a new post.

blorg gravatar imageblorg ( 2017-11-15 08:24:35 -0500 )edit

answered 2017-08-08 21:03:18 -0500

SteveEbey73701 gravatar image

Step 1: run df -h for a readable list of your filesystem, showing the size of each device. make note of the dev/sd? name for your ssd and hdd based on the sizes you know them to be. the output should look similar to this.

Filesystem               Size  Used Avail Use% Mounted on
devtmpfs                 7.8G     0  7.8G   0% /dev
tmpfs                    7.9G   48K  7.9G   1% /dev/shm
tmpfs                    7.9G  1.5M  7.9G   1% /run
tmpfs                    7.9G     0  7.9G   0% /sys/fs/cgroup
/dev/mapper/fedora-root   50G   37G  9.9G  79% /
tmpfs                    7.9G   12K  7.9G   1% /tmp
/dev/sdb1                976M  375M  535M  42% /boot
/dev/sdc1                1.4T  841G  558G  61% /mnt/ntfs
/dev/mapper/fedora-home  236G  122G  102G  55% /home
tmpfs                    1.6G   32K  1.6G   1% /run/user/1000

Step 2: run df /path/filename -P to see the mount point for that file. You can wildcard with * after path, to see all files in a given directory, like this.

[steve@linuxbox-desktop ~]$ df /home/steve/Downloads/NVIDIA-Linux-x86_64-3* -P
Filesystem              1024-blocks      Used Available Capacity Mounted on
/dev/mapper/fedora-home   246795500 127421276 106814660      55% /home
/dev/mapper/fedora-home   246795500 127421276 106814660      55% /home
/dev/mapper/fedora-home   246795500 127421276 106814660      55% /home
/dev/mapper/fedora-home   246795500 127421276 106814660      55% /home
/dev/mapper/fedora-home   246795500 127421276 106814660      55% /home
/dev/mapper/fedora-home   246795500 127421276 106814660      55% /home
/dev/mapper/fedora-home   246795500 127421276 106814660      55% /home

Hope this helps.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2017-08-08 15:09:30 -0500

Seen: 288 times

Last updated: Nov 15 '17