Tag Info

Hot answers tagged

43

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


24

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


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

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.


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


14

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


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


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

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


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

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


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

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

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


8

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


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

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


8

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


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

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


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


6

(You didn't specify your operating system. I'm assuming it's some variant of GNU/Linux, the general concept applies to other UNIXes as well; details may not.) 1. How does one know what the device file for a device is in general? Basically, you have to know which device file name corresponds to which device. Sources of this information are the Linux ...


6

udev outputs logging information to /var/log/messages, but by default it only logs errors, and it happens you've constructed a command that doesn't do what you want, but also doesn't error out. The >> redirection is handled by your shell, and udev doesn't run the command through a shell, so it's literally running the binary /bin/echo and passing it the ...


6

udev knows your system. so you can get info through udevadm , under /sys/ like this (run as root, or with sudo depending on your distro) udevadm info -a -p /sys/block/sdb udevadm info -a -p /sys/block/sdc reading through the output you'll come across some meaningful results, such as ATTRS{vendor} ATTRS{model} you should be able to get some info about ...


6

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



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