328

Linux automatically detects SSD, and since kernel version 2.6.29, you may verify sda with: cat /sys/block/sda/queue/rotational You should get 1 for hard disks and 0 for a SSD. It will probably not work if your disk is a logical device emulated by hardware (like a RAID controller). See this answer for more information...


216

There are many tools for that, for example fdisk -l or parted -l, but probably the most handy is lsblk (aka list block devices): Example $ lsblk NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT sda 8:0 0 238.5G 0 disk ├─sda1 8:1 0 200M 0 part /boot/efi ├─sda2 8:2 0 500M 0 part /boot └─...


104

With lsblk (part of the util-linux package): lsblk -d -o name,rota NAME ROTA sda 0 sdb 0 sdc 1 where ROTA means rotational device (1 if true, 0 if false)


89

When a program reads or writes data from a file, the requests go to a kernel driver. If the file is a regular file, the data is handled by a filesystem driver and it is typically stored in zones on a disk or other storage media, and the data that is read from a file is what was previously written in that place. There are other file types for which different ...


53

Use smartctl (install by installing smartmontools) to retrieve vendor information, sudo smartctl -a /dev/sdb If you see a line like this, Rotation Rate: Solid State Device That would be a SSD drive.


51

If I understand your question you want to know which device was used for a given mount. For this you can use the df command: $ df -h Filesystem Size Used Avail Use% Mounted on /dev/mapper/fedora_greeneggs-root 50G 21G 27G 44% / devtmpfs 3.8G 0 3.8G 0% /dev tmpfs 3....


44

Use geom disk list. This will show all disk-like devices (technically, every instance of GEOM "DISK" class). For more information: geom | FreeBSD Manual Pages


35

I think you might be able to accomplish what you want using network block devices (NBD). Looking at the wikipedia page on the subject there is mention of a tool called nbd. It's comprised of a client and server component. Example In this scenario I'm setting up a CDROM on my Fedora 19 laptop (server) and I'm sharing it out to an Ubuntu 12.10 system (client)...


33

https://wiki.gentoo.org/wiki/Device-mapper#Zero See Documentation/device-mapper/zero.txt for usage. This target has no target-specific parameters. The "zero" target create that functions similarly to /dev/zero: All reads return binary zero, and all writes are discarded. Normally used in tests [...] This creates a 1GB (1953125-sector) zero target:...


32

On Linux we have findmnt from util-linux exactly made for this findmnt -n -o SOURCE --target /path/to/FILE The advantage about other solutions is that it still works if paths are obscured by symlinks or duplicate bind mounts.


30

Those are simply (special) files. They only serve as "pointers" to the actual device. (i.e. the driver module inside the kernel.) If some command/service already opened that file, it already has a handle to the device and will continue working. If some command/service tries to open a new connection, it will try to access that file and fail because of "file ...


29

I needed to do this on the VPS and none of the provided solutions worked for me, this answer did the trick https://serverfault.com/questions/551453/how-do-i-verify-that-my-hosting-provider-gave-me-ssds/551495#551495 so, it is about reading random data from the drive and assessing the time. time for i in `seq 1 1000`; do dd bs=4k if=/dev/sda count=1 ...


28

There are multiple ways of accomplishing this. 1. Add your user to the group that owns the device Generally in most distros, block devices are owned by a specific group. All you need to do is add your user to that group. For example, on my system: # ls -l /dev/sdb brw-rw---- 1 root disk 8, 16 2014/07/07-21:32:25 /dev/sdb Thus I need to add my user to ...


28

Another way to quickly see the filesystems is the command df. On my machine (Finnish localization) it shows like this: ptakala@athlon:/mnt$ df Tiedostojärjestelmä 1K-lohkot Käyt Vapaana Käy% Liitospiste /dev/root 38317204 19601752 16762352 54% / devtmpfs 4063816 0 4063816 0% /dev tmpfs 4097592 ...


26

Assuming you're on Linux. Try: sudo /lib/udev/scsi_id --page=0x80 --whitelisted --device=/dev/sdc or: cat /sys/block/sdc/device/{vendor,model} You can also get information (including labels) from the filesystems on the different partitions with sudo blkid /dev/sdc1 The pathid will help to determine the type of device: readlink -f /sys/class/block/sdc/...


26

libata does not have a noprobe option at all; that was a legacy IDE option... But I went and wrote a kernel patch for you that implements it. It Should apply to many kernels very easily (the line above it was added 2013-05-21/v3.10-rc1*, but can be safely applied manually without that line). Update The patch is now upstream (at least in 3.12.7 stable ...


25

There're handy dmsetup ls --tree and lsblk utils.


25

Yes, you can do this with the /sys filesystem. /sys is a fake filesystem dynamically generated by the kernel & kernel drivers. In this specific case you can go to /sys/block/sda and you will see a directory for each partition on the drive. There are 2 specific files in those folders you need, start and size. start contains the offset from the beginning ...


24

The other answers don't show the UUID which is useful to use as reference in boot scripts and configs like /etc/hdparm. so here: $ sudo lsblk --output NAME,FSTYPE,LABEL,UUID,MODE NAME FSTYPE LABEL UUID MODE sda brw-rw---- ├─sda1 ntfs WinHyperX ...


24

Probably you will never be able to find a simple definition of this. But in the most general and simplistic way, if you compare a character device to a block device, you can say the character device gives you direct access to the hardware, as in you put in one byte, that byte gets to the hardware (of course it is not as simple as that in this day and age). ...


23

You can throttle a pipe with pv -qL (or cstream -t provides similar functionality) tar -cf - . | pv -q -L 8192 | tar -C /your/usb -xvf - -q removes stderr progress reporting. The -L limit is in bytes. More about the --rate-limit/-L flag from the man pv: -L RATE, --rate-limit RATE Limit the transfer to a maximum of RATE bytes per second. A ...


23

SCSI is not only a type of hardware interface, but also a command protocol, which is used for abstraction of most of the modern storage devices. Linux scsi driver is a high level driver that handles a variety of storage hardware. Protocol: http://en.wikipedia.org/wiki/SCSI_command Extract from SCSI on wikipedia: Other technologies which use the SCSI ...


22

You can look in /sys/block: -bash-3.2$ ls -ld /sys/block/sd*/device lrwxrwxrwx 1 root root 0 Jun 8 21:09 /sys/block/sda/device -> ../../devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0 lrwxrwxrwx 1 root root 0 Jun 8 21:10 /sys/block/sdb/device -> ../../devices/pci0000:00/0000:00:1f.2/host1/target1:0:0/1:0:0:0 lrwxrwxrwx 1 root root 0 Jun 8 ...


22

On a hybrid solid-state and spinning disk system (like the one I'm typing this), you have two to three aims: Speed up your system: as much commonly used data as possible stays on the SSD. Keep volatile data off the SSD to reduce wear. Optional: have some level of redundancy by using an md(4) (‘software RAID’) setup across the SSD and HDD(s). If you're just ...


22

Mounts, typically, must be done on block devices. The loop driver puts a block device front-end onto your data file. If you do a loop mount without losetup then the OS does one in the background. eg $ dd if=/dev/zero of=/tmp/foo bs=1M count=100 100+0 records in 100+0 records out 104857600 bytes (105 MB) copied, 0.0798775 s, 1.3 GB/s $ mke2fs /tmp/foo ...


21

You can do that with the device mapper and its snapshot target. Basically, you'd do the same as what LVM does when you create a writable snapshot. dev=/dev/read-only-device ovl=/path/to/overlay.file newdevname=newdevice size=$(blockdev --getsz "$dev") loop=$(losetup -f --show -- "$ovl") printf '%s\n' "0 $size snapshot $dev $loop P 8" | dmsetup create "$...


20

One alternative to nbd (if you're interested) is using iSCSI. tgtd can be configured to have a /dev device as its backing storage for a particular iSCSI IQN. If you're on a RHEL system so you just need to install scsi-target-utils and then configure/start tgtd on the source system. Configuration of tgtd can get involved but Red Hat provides plenty of ...


18

From what I can tell, camcontrol devlist is the closest thing to a lsblk variant for FreeBSD. I'm not 100% sure that this is the best method, but its output is very close to what lsblk gives you, if you only care about /dev/<DEV-PATH> and device names: $ camcontrol devlist <VBOX HARDDISK 1.0> at scbus0 target 0 lun 0 (ada0,pass0) <VBOX CD-...


18

File systems expect to read from and write to block devices, but image files aren’t block devices. Loop devices provide a block device on top of a file (or another block device, optionally with remapping). There’s no need to consider loop devices when mounting images in many cases because mount takes care of everything for you; but loop devices are still ...


Only top voted, non community-wiki answers of a minimum length are eligible