Tag Info

Hot answers tagged

5

I think you're looking for pmount. If you want automatic mounting upon insertion, see Automounting USB sticks on Debian. The program that reacts when a new device appears is udev, so automatic mounted is triggered by a udev rule. The usbmount package provides udev rules to automatically mount USB storage devices and a few others. You cannot automatically ...


5

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


3

You are asking for the impossible. Anyone who has the password to the superuser (root) account has full access to the entire system. root needs that sort of access to be able to administer the system. There is no user account more privileged than root in Linux. Based on what you wrote in the comments, there are a few obvious alternatives: Don't give the ...


3

+1 for Gabriel's answer - O_EXCL is exactly the solution I used in this scenario. Here's the Perl function I wrote to check if a device is in use: use Fcntl; use Errno; sub device_in_use($) { my $device = shift; # open with O_EXCL returns EBUSY if a device is in use # http://www.kernel.org/doc/man-pages/online/pages/man2/open.2.html return ...


3

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


3

The locate database is generally configured to omit files on removable disks, since they can't be assumed to be there later. It can be configured through a file such as /etc/updatedb.conf (the location depends on which of the several locate programs you use and how it is configured by your distribution). For a removable disk, it is probably better to keep ...


3

Most “live CD” distributions can be installed on a pen drive instead of a CD. Then you can use the rest of the pen drive (if it's large enough) as storage. For example, for Ubuntu, prepare a “live CD” on a USB pen drive. The pen drive creator utility will let you choose how much space to devote to storage. Alternatively, just do a normal installation that ...


2

You don't have to export the VG, that's used to migrate a VG from one system to another. Simply vgchange -an vgname to deactivate all logical volumes on the volume group you wish to unplug. Later, after plugging the device back in, vgchange -ay vgname will reactivate all logical volumes in your vgname VG and then you can mount LVs and use. Device ...


2

I heartily recommend Puppy Linux in on of its many derivatives: I use it every day on my computers and found it will simply work, easily. Also it will fully load in RAM so you don't have to bother with drive speed. It has all what you ask and works on most hardware also where many other distro fail. Not recommended if you are scared to running always as ...


2

First, in order to work with NTFS (a proprietary file system) you need to install ntfs-3g: # pacman -S ntfs-3g There is a page on the the Arch Wiki that will step you through configuration options, such as automounting and user access...


2

Filesystems designed for unix, such as ext4, track the user via a number, the user ID. The user name is not recorded. You can see your own user ID with the command id -u. You can see the user ID who owns a file with ls -ln /path/to/file. If you take an ext4 filesystem to a different machine, the files will still have the same permissions, and they will have ...


2

Ok, so to pull this in a list, you can use the same command I gave you before, but just drop the removeable requirement: % for blk in $(lsblk -ndo name) ; do > udevadm info --query=all --name "$/dev/$blk" |\ > grep -q ID_BUS=usb && printf \ > 'findmnt %s -no TARGET ;'\ > "/dev/$blk" ...


1

I think I have it: Replacing grep -Hv 0 /sys/block/*/removable by grep -Hv ^ATA\ *$ /sys/block/*/device/vendor seem work: export USBKEYS=($( grep -Hv ^ATA\ *$ /sys/block/*/device/vendor | sed s/device.vendor:.*$/device\\/uevent/ | xargs grep -H ^DRIVER=sd | sed s/device.uevent.*$/size/ | xargs grep -Hv ^0$ | cut -d / -f 4 )) for ...


1

It sounds like you are looking for a persistent USB install? Is that correct? The basic procedure is to install your Linux distribution on to the USB drive and then boot from it. The trick is making the Linux install persistent, the basic procedure is (shamelessly copied adapted from here) Boot into a Live Session of your Linux of choice (Ubuntu in this ...


1

I like to use this one-liner. find /dev/disk/by-path -name "*-usb-*" -not -name "*-part*" -exec readlink -f {} \; It will 1) list all devices with USB in its path somewhere, 2) filters for partitions and finally 3) reads the link it points to. Example output: /dev/sdc Important notes: It will not work for external disks connected using another bus, ...


1

To find your USB drive, first issue: blkid then you will see something like: /dev/sdxy: LABEL="USB_DRIVE_LALBEL" UUID="USB_DRIVE_UUID" TYPE="IT'S_FILE_SYSTEM_TYPE" where as /dev/sdxy is your usb drive which x={a,b,c or d} and y={1,2,3,...} now issue: mount -l|grep /dev/sdxy it will show (something like): /dev/sdxy on /PATH/TO/USB/MOUNT/PLACE type ...


1

Ok, it's been a long time, but I'll still answer my question with the best option I found as of now. The best way is to create a udev rule, associated with some scripts (that will create / remove directories and mount / unmount removable devices), and attached to partition udev device event type. 1 - Creating add / remove scripts Add this script ...


1

I use a script similar like this one: unmount all filesystems in the volume group vg_name if all filesystems in vg_name are unmounted, set the VG to unavailable don't forget to sync memory buffers to disk ... sispmctl is used to power off my external disks #!/bin/bash echo "Unmounting filesystem" mount | grep vg_name && { mount | grep vg_name | ...



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