101

Are you using a 64-bit version of Linux with a lot of memory? In that case the problem could be that Linux can lock for minutes on big writes on slow devices like for example SD cards or USB sticks. It's a known bug that should be fixed in newer kernels. See http://lwn.net/Articles/572911/ Workaround: as root issue: echo $((16*1024*1024)) > /proc/...


97

Yes. For example: sudo eject /dev/sda Other answers here that indicate that you require mechanical ejection hardware are incorrect. Unmounting is not the same thing as ejecting. If you unmount a volume, you can immediately mount it back, because the underlying device is still available. In some situations, this could present a security risk. By ejecting ...


58

On Linux, eject will work, but will not really "finish the job" regarding USB rotating drives. The best way to unplug a USB external hard-drive, after proper unmounting, is: udisksctl power-off -b /dev/sdb or udisks --detach /dev/sdb This usually causes the drive to spin down gracefully. Note: udisksctl might be a more "mainstream" tool,...


50

There is a vendor independent SAT (SCSI/ATA transfer) standard, but AFAIK this is not widely supported on (cheaper) bridges. There are several vendor specific ATA pass-through commands that you can select with smartctl with the -d option: -d TYPE, --device=TYPE Specify device type to one of: ata, scsi, sat[,N][+TYPE], usbcypress[,X], usbjmicron[,x][,...


43

To create a bootable USB, you can follow the steps below: STEP 1 Go to the website of the OS you wish to install, and find an iso image to download. In your case, since you want to run a Debian OS, here is a link to its iso options: https://www.debian.org/distrib/netinst Choose an iso image from the options, and click on it. This should automatically ...


29

Like any unix-style filesystem, ext4 includes standard Unix file ownership and permission conventions. That is, the user is identified by an UID number, and each user will belong to one or more groups, each group identified by its GID number. Each file has an owner UID and one group owner GID. The three classic Unix file permission sets are: one set of ...


27

qemu-kvm has disappeared. use the hint in start qemu by giving it a path to a linux root instead. this means qemu-system-x86_64 -usb -usbdevice disk:/dev/sdb where /dev/sdb is your raw device (not partition) of the usb stick that you want to boot. (however, as of 12/2014, it's been flaky for me. booting ubuntu-gnome 14.10 results eventually in a kernel ...


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

systemd-udevd runs in its own file system namespace and by default mounts done within udev .rules do not propagate to the host. To make your old scripts work you can set MountFlags=shared in /usr/lib/systemd/system/systemd-udevd.service or (better) creating and editing its copy at /etc/systemd/system/ See man 5 systemd.exec for more information, MountFlags ...


20

Manual steps for unmounting disk /dev/sdb (Requires sudo): echo 'offline' > /sys/block/sdb/device/state echo '1' > /sys/block/sdb/device/delete This will completely power-off the device and detach it from the system. It won't be detected again till it is disconnected and re-attached.


19

This is the behavior I have on my Ubuntu Lucid system: When I plug in my USB flash/thumbdrive which has two partitions, the system reports: $ ls /dev/sdb* /dev/sdb /dev/sdb1 /dev/sdb2 $ udisks --show-info /dev/sdb | grep -A2 'partition table\|by-id' by-id: /dev/disk/by-id/usb-takeMS_USB_Mini_AA07013000010057-0:0 by-path: ...


18

This is Gilles' answer, saving it here so it doesn't get lost. If you use the sync mount option on the removable drive, all writes are written to the disk immediately, so you won't lose data from not-yet-written files. It's a bad idea, but it does what you're asking, kind of. Note that sync does not guarantee that you won't lose data. Unmounting a ...


17

The problem with the timestamp seconds changing comes from the fact that a VFAT (yes, even FAT32) filesystem stores the modification time with only 2-second resolution. Apparently, as long as the filesystem is mounted, the filesystem driver caches timestamps accurate to 1-second resolution (probably to satisfy POSIX requirements), but once the filesystem ...


13

Looks like this device is mounted. Run umount /dev/sdb1 and try again.


12

If you use the sync mount option on the removable drive, all writes are written to the disk immediately, so you won't lose data from not-yet-written files. It's a bad idea, but it does what you're asking, kind of. Note that sync does not guarantee that you won't lose data. Unmounting a removable drive also ensures that no application has a file open. If you ...


12

Patient: "Doctor, It hurts when I do this." Doctor: "Well, don't do that." — maybe the Marx Brothers, but they probably stole it from other vaudevillians if so Both answers are fine, but I do question the question. If you can't remember to unmount a thumbdrive properly before removing it, perhaps you should remember harder. In general, the problem ...


11

If a USB flash device and USB cdrom is connected then only difference that I can find out is their kernel driver. Both uses the common usb and usb-storage kernel module but in addition to that CD-ROM uses sr module while USB uses the sd module. Based on this info, you can write UDEV rule


11

EDIT: It turns out my first approach didn't work as expected. An [Install] section on an overrides file doesn't really work and RequiresMountsFor= seems to only work for mounts which are declared in fstab. Therefore, I'm proposing an alternative that will accomplish the same effects, but using different directives. In order to prevent the unit from starting ...


10

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


10

I suspect you are using a mount command like the one below: mount -t msdos /dev/XYZ /mnt/test This will force the partition to be mounted in legacy DOS FAT filesystem which uses the 8.3 filename convention (See https://en.wikipedia.org/wiki/8.3_filename) instead of vfat which uses Long filenames (https://en.wikipedia.org/wiki/Long_filename). ...


9

You can use graphical tools to achieve this, such as GParted. You can install this like so: apt-get update apt-get install gparted Your OS may also include a graphical package manager, if so, you can alternatively install the gparted package from there. After gparted is installed, run it. Select your flash drive (be careful, make sure it is the right ...


9

udevadm info -a -n /dev/sdb Now check for Kernel. E.g. if it is connected to Port 2 of Front UIP then it would be 1-1.2 and if it is connected to Port 1 of Front UIP then it would be 1-1.1. For Port 2 : To disconnect USB : echo '1-1.2' | tee /sys/bus/usb/drivers/usb/unbind To connect USB : echo '1-1.2' | tee /sys/bus/usb/drivers/usb/bind


9

Ok, the summary is that Nautilus uses GVFS and you need to tell udev to use GVFS too when reading the fstab entries, you can do this using: /dev/block-device /mount/point auto x-gvfs-show,ro 0 0 x-gvfs-show will tell udev and anyone interested to use the GVFS helper to mount the filesystem, so gvfs has all the control mounting, umounting, moving mount ...


9

After attaching your USB drive to a server, run in terminal lsblk, you will see all storage devices, that are attached to your machine. You may find there your USB drive (usually, they are named /dev/sdb or /dev/sdc, but is it NECESSARY to re-check that). After that, you have to mount it to have possibility to read/write, for example: mount /dev/sdb1 /mnt/ ...


9

Your 8GB stick has approximately 7.5 GiB and even with some file system overhead should be able to store the 5.4GiB file. You use tune2fs to check the file sytem status and properties: tune2fs -l /dev/<device> By default 5% of the space is reserved for the root user. Your output lists 97894 blocks, which corresponds to approximately 385MiB and seems ...


9

I have just successfully formatted a completely blank floppy in a USB drive. This required a proper format, and not just writing a filesystem to the disk, because there were no sectors on it yet. This is done with the ufiformat program, which is specifically designed to work with USB floppy drives. $ sudo ufiformat -f 1440 -v /dev/sdd format on device=/...


9

Turns out that there's a 1 second timeout int drivers/usb/storage/usb.c. I enabled more debug-logging by typing the following two commands: echo 8 > /proc/sys/kernel/printk echo "module usb_storage +p" > /sys/kernel/debug/dynamic_debug/control echo 0xFFFFFF > /proc/sys/dev/scsi/logging_level The scsi subsystem has a weird (compared to the rest of ...


8

I used ENV{MTP_NO_PROBE}="1" to stop the MTP Probe. That way I didn't have modify the Arch's /lib/udev/rules.d/69-libmtp.rules. export MTP_NO_PROBE="1"


8

There are many ways to format a USB Command line Type this command in the terminal which will help you identify the USB name i.e: sdb,sdc,etc... sudo fdisk -l Make sure the USB is not mounted, if yes then you need to unmount it: umount /dev/sdX Replace sdX with your device name Delete any existing partitions (from the SD card only). Enter the ...


8

UPDATE So, I really didn't think I would be researching NTFS this morning, but, thanks mostly to @AndrewMedico's comments below, I learned something. The truth is file streams are weird, and they confuse me, but apparently it gets deeper. Behaving in a way very like NTFS file streams, Transactional NTFS commits file changes to some alternate cache until ...


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