Tag Info

Hot answers tagged

54

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. See this answer for more information...


25

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 ...


21

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 ...


16

Use smartctl 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.


16

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. You're probably 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 ...


15

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 ...


14

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 ...


13

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 ...


13

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 ...


11

Run udevadm info -a -n /dev/sda and parse the output. You'll see lines like DRIVERS=="ahci" for a SATA disk using the ahci driver, or DRIVERS=="usb-storage" for an USB-connected device. You'll also be able to display vendor and model names for confirmation. Also, ATTR{removable}=="1" is present on removable devices. All of this information can also ...


11

You can throttle a pipe tar -cf - . | throttle -M 1 | tar -C /your/usb -xvf - -b -k -m limits are in bits -B -K -M are bytes


10

hdparm -i /dev/sdb That should give you the model and serial number of the drive.


10

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 ...


10

Globbing (which is what you're doing with your wildcard matching) will expand the current command line. For example: ls [abc]1 gets expanded to: ls a1 b1 c1 Globbing only works where the command allows multiple arguments. While umount /dev/sdc2 /dev/sdd2 Works, there's no way to express the same thing for mount. So you have to loop it: for m in ...


9

I think I found the answer: blkid From the man page: The blkid program is the command-line interface to working with the libblkid(3) library. It can determine the type of content (e.g. filesystem or swap) that a block device holds, and also attributes (tokens, NAME=value pairs) from the content metadata (e.g. LABEL or UUID ...


9

It's a Xen device. See e.g. Xen on Debian wiki


9

Hardware problems have physical hardware solution. Did you consider to unsolder or cut the power supply of the drive ? EDIT: Ok if thats not an option people are using this before to hot-plug a hard drive. You could use that to disable your drive. echo 1 > /sys/block/sdb/device/delete Note that any other process can force a scan of the SATA bus, and ...


9

I would assume you are trying not to disrupt other activity. Recent versions of Linux include ionice which does allow you to control the scheduling of IO. Besides allowing various priorities, there is an additional option to limit IO to times when the disk is otherwise idle. The command man ionice will display the documentation. Try copying the file ...


9

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 ...


9

I know dd is supposed to be a power user tool but still, it doesn't make sense to me that you can basically screw your whole computer by hitting the wrong key. Consider the kinds of power tools used in civil construction and what you can screw up by doing one little thing wrong. Could those things be made more preventable? Probably, but the counter ...


8

I don't think you can do it in place but if you have enough space this should work: # Create the files that will hold your data dd if=/dev/zero of=part-00 bs=1M count=4k dd if=/dev/zero of=part-01 bs=1M count=4k # Create the loop devices losetup /dev/loop0 part-00 losetup /dev/loop1 part-01 # Create a RAID array mdadm --create /dev/md0 --level=linear ...


8

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


8

On recent version of Linux, there are /dev/disk/by-{id,label,path,uuid} directories that contain automagic symlinks to the various /dev/sdX and /dev/sdXN entries (I believe all of these are setup by udev). These provide more stable and informative names for your disks and partitions. I find /dev/disk/by-label/ the most useful (especially if you label your ...


8

I would suggest you use udev to set parameters for the SSD disks. This way you can configure a specific queue scheduler that is more appropriate for SSD, etc. You can also apply parameters only to some of the devices, based on a lot of parameters. You can obtain the specific attributes necessary to match your devices (eg. the disk model and manufacturer) by ...


8

Have a look under the /sys/ directory. In particular, /sys/block/ contains symlinks to block devices in /sys/devices/. /sys/block/sdX/removable looks like it will read as 1 for a removable device, and 0 otherwise. This gives you a basic check for removability. I'm not sure if there's a better way to check if it's a USB device, but readlink /sys/block/sde ...


7

If you can see the LED on the drive, or listen to the disk noise, you can run sudo cat /dev/sdb >/dev/null and see which drive suddenly becomes continuously active. Or, if you're going by noise, sudo find /mount/point >/dev/null which will make the heads move more (it may be better not to do it on the failing disk, and instead use a process of ...


7

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 --getsize -- "$dev") loop=$(losetup -f --show -- "$ovl") printf '%s\n' "0 $size snapshot $dev $loop P 8" | dmsetup ...


7

You can get the answer by using df command on the directory containing the executable. For example, on you example, you could say df /tmp/example


6

That's to do with the kernel doing a lot of buffering, including buffering writes to your device. If you issue: cp large_file /mnt/htc/ cp will return as soon as it has finished writeing the data, but (for reasonably "slow" devices/connections) well before that data has actually been written. (Unless cp or the tool you use itself issues fsync or similar ...



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