65

I think have installed Ubuntu on SSD but I'm not sure and I want to check this. But I do not know how to?

3
  • 2
    Well do you have anything other than an SSD? Jun 29, 2016 at 16:18
  • I in my configuration stays 500GB HD ST500LM000-SSHD-8GB (LVD4)
    – moonlight
    Jun 29, 2016 at 16:19
  • 7
    CLOSE VOTERS: The question is not off-topic . It clearly asks a specific question, related to Ubuntu OS , and can be solved with Ubuntu tools. Either retract your votes, or provide a good reason why you think your vote is correct Jun 30, 2016 at 23:42

3 Answers 3

78

Dude, where's my root?

First of all we need to know on what disk your root filesystem is located ( in other words , what device houses your Ubuntu. One way is with df.

$ df / -h                                                                       
Filesystem      Size  Used Avail Use% Mounted on
/dev/sda1       110G   58G   48G  55% /

Great ! I now know that my Ubuntu is placed onto /dev/sda disk, which is 110 GB in size ( and the other 10 GB are used for something else). Not enough info ? OK, how about this:

$ sudo lshw -short -C disk                                                      
[sudo] password for xieerqi: 
H/W path         Device     Class          Description
======================================================
/0/1/0.0.0       /dev/sda   disk           120GB Radeon R7
/0/2/0.0.0       /dev/sdb   disk           500GB TOSHIBA MQ01ABF0

Oh, Radeon R7 ! that's my SSD ! But wait . . .

What if you have two disks that are the same size and the same manufacturer?

Well, disks have this very interesting bit of information - how fast they rotate, and as we know SSD disks don't rotate.

$ sudo smartctl -a /dev/sda | grep 'Rotation Rate'                              
[sudo] password for xieerqi: 
Rotation Rate:    Solid State Device

Looks about right ?

Side-note: the smartmontools may need to be installed in order to use smartctl command.

For more info, read this post on Unix and Linux stackexchange site

Additional update:

There's one more method , as described here. Each drive has corresponding directory in /sys/class/block/ directory, and by doing

cat /sys/class/block/DEVICE_NAME/queue/rotational

you will get either 1 for hard drive or 0 for ssd. This approach is very convenient for usage in scripts

In fact, that's apparently the same approach that lsblk uses:

$ lsblk -o NAME,ROTA                                                                                                                  
NAME   ROTA
sda       0
└─sda1    0
sdb       1
├─sdb1    1
├─sdb2    1
├─sdb3    1
├─sdb4    1
├─sdb5    1
└─sdb6    1
5
  • @Serg wait that's weird. Isn't the Radeon R7 a GPU? Jun 30, 2016 at 14:27
  • @shortstheory I get this question a lot , but it is really an SSD. If you want I can provide amazon links and pictures of my drive if you want :) Jun 30, 2016 at 23:40
  • 1
    I think this works, up to a certain point... What if the partition is encrypted for instance? Your "df" call will result in something like /dev/dm-1 463867688 405671304 34610184 93% / which doesn't really help :-/ Still voting up as I think you're nailing the most common cases. Jul 6, 2016 at 10:07
  • @LittleJawa well, as far as encrypted partitions go, I'd love to cover that case, but I've never dealt with one, so I wouldn't know. it's a good point and I hope somebody does go over it. I'd guess that even though the device file is named differently, the idea remains the same, but like i said - i am not qualified in the matter of encrypted files Jul 6, 2016 at 10:40
  • The general idea would be the same. You'd have additional steps to identify where the de-crypted partition comes from. It will depend on the encryption tool you use - with LUKS, I'd look after the "cryptsetup" utility to find that... anyway - the question owner picked your answer as the right one, so I guess this closes the subject :) If/when we have the same question related to crypted partition, we'll look into it :-p Jul 6, 2016 at 11:17
47

A simple way to tell if your OS is installed on SSD or not is to run a command from a terminal window called lsblk -o name,rota. Look at the ROTA column of the output and there you will see numbers. A 0 means no rotation speed or SSD drive. A 1 would indicate a drive with platters that rotate. My Ubuntu is installed on my /dev/sdb drive, so we can see that one indicates a 0 which means it is installed on a SSD drive. I put after this example of how to tell where your OS is installed using df.

NOTE: Ubuntu that is installed as a client in either loop or VMs will show ROTA 1 regardless of host OS installation. Also, "solid-state hybrid drives" and USB flash drives will also show ROTA 1.

Example:

terrance@terrance-ubuntu:~$ lsblk -o name,rota
NAME   ROTA
sda       1
└─sda1    1
sdb       0
├─sdb1    0
├─sdb2    0
└─sdb5    0
sdc       1
└─sdc1    1
sdd       1
└─sdd1    1
sde       0
├─sde1    0
└─sde2    0
sdf       1
└─sdf1    1
sdg       1
└─sdg1    1
sdh       1
└─sdh1    1
sr0       1
sr1       1

Or you can do the check as a one liner script using -d to not show partitions:

lsblk -d -o name,rota | awk 'NR>1' | grep -v loop | while read CC; do dd=$(echo $CC | awk '{print $2}'); if [ ${dd} -eq 0 ]; then echo $(echo $CC | awk '{print $1}') is a SSD drive; fi; done

Example:

terrance@terrance-ubuntu:~$ lsblk -d -o name,rota | awk 'NR>1' | grep -v loop | while read CC; do dd=$(echo $CC | awk '{print $2}'); if [ ${dd} -eq 0 ]; then echo $(echo $CC | awk '{print $1}') is a SSD drive; fi; done
sdb is a SSD drive
sde is a SSD drive

To determine what drive your installation is on, run the command df / from a terminal window.

NOTE: Drives configured with LVM (Logical Volume Management) actually show the drive as /boot instead of /.

Examples:

LVM Drive:

df /
Filesystem                   1K-blocks      Used Available Use% Mounted on
/dev/mapper/xubuntu--vg-root 243352964 106945028 123976576  47% /

df /boot
Filesystem     1K-blocks   Used Available Use% Mounted on
/dev/sda1         720368 237220    430756  36% /boot

Non-LVM Drive:

df /
/dev/sdb1       222309012   38264268  172728984  19% /

UPDATE: lsblk can also be used to show where the OS is installed and if the drive is SSD all in one command:

lsblk -o NAME,MOUNTPOINT,MODEL,ROTA

Example:

terrance@terrance-ubuntu:~$ lsblk -o NAME,MOUNTPOINT,MODEL,ROTA
NAME   MOUNTPOINT         MODEL            ROTA
sda                       Backup+ Desk        1
└─sda1 /media/Seagate                         1
sdb                       WDC WD2500JD-00K    1
└─sdb1 /media/250GB_SHARE                     1
sdc                       WDC WD5000AAKS-4    1
└─sdc1 /media/500GB                           1
sdd                       ST500DM002-1BC14    1
└─sdd1 /media/320GB                           1
sde                       SanDisk SDSSDA24    0
├─sde1 /                                      0
├─sde2                                        0
└─sde5 [SWAP]                                 0
sdf                       WDC WD5000AAKX-2    1
└─sdf1 /media/WD500GB                         1
sdg                       WDC WD10EZEX-00W    1
└─sdg1 /media/1TB_SHARE                       1
sdh                       SanDisk SDSSDA24    0
├─sdh1                                        0
└─sdh2 /media/Windows                         0
sr0                       BD-RE  BH16NS40     1
sr1                       DVD-RAM GH40L       1

This is after a system reboot, so my drive designations changed again, but as you can see my SanDisk drives are SSDs and ROTA shows 0.


Hope this helps!

7
  • 1
    How does it show where an OS is installed?
    – Pilot6
    Jun 29, 2016 at 16:31
  • I don't know where my os is installed but according to this ,it's on sda and it's not on SSD.NAME ROTA sda 1 ├─sda1 1 ├─sda2 1 └─sda5 1 sr0 1
    – moonlight
    Jun 29, 2016 at 16:38
  • @Pilot6 Good point, updated my answer. Thank you! =)
    – Terrance
    Jun 29, 2016 at 16:39
  • @moonlight I updated my answer with an explanation at the bottom to show how to tell where it is installed at.
    – Terrance
    Jun 29, 2016 at 16:39
  • +1. Interestingly, on my system which is SSD based, loop0 rotates. The only other rotating device output by lsblock is my optical drive. Jun 29, 2016 at 21:53
1

In the end your question isn't really a Ubuntu question. You have a Hard Drive with a small, relative to the size of the HD, amount of flash storage. This is managed automatically for you by the drive and tries to place the more frequently accessed files on the Flash portion rather than the HD portion. As far as I know there is no way to control or tell what files are on which portion. If you regularly use Ubuntu all the important files should end up in the flash portion of your drive but that's about it.

0

You must log in to answer this question.

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