LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   copying files to /proc/bus/usb (https://www.linuxquestions.org/questions/linux-newbie-8/copying-files-to-proc-bus-usb-590484/)

ic_torres 10-09-2007 05:39 AM

copying files to /proc/bus/usb
 
hi. i got a usb hardisk (enclosure) 80G that is partition into 4 of 20G. it was read by /proc/bus/usb.. owned by root :

[root@vector/proc/bus/usb]# ls -l
total 0
dr-xr-xr-x 2 root root 0 2007-10-09 16:12 001/
dr-xr-xr-x 2 root root 0 2007-10-09 16:12 002/
dr-xr-xr-x 2 root root 0 2007-10-09 16:12 003/
dr-xr-xr-x 2 root root 0 2007-10-09 16:12 004/
-r--r--r-- 1 root root 0 2007-10-09 16:12 devices


the problem is. . . i cannot copy files from it..

samples :

[root@vector/proc/bus/usb/001]# mkdir test
mkdir: cannot create directory `test': Operation not permitted

attempted to copy a file from my windows partition :

[root@vector/mnt/winbak]# cp lilo_vect5.8 /proc/bus/usb/001/
cp: cannot create regular file `/proc/bus/usb/001/lilo_vect5.8': Permission denied

do i have to configure something else? i google some sites.. i read some articles that usb hard disk should have an fs? is this true? because im also using my usb hd in windows. . .

i thought that this is just the same when using a usb flash drive. . :(

ghostdancer 10-09-2007 05:42 AM

Err... You are not suppose to that. You should try to understand what is the function of /proc/

Quote:

The Linux kernel has two primary functions: to control access to physical devices on the computer and to schedule when and how processes interact with these devices. The /proc/ directory contains a hierarchy of special files which represent the current state of the kernel — allowing applications and users to peer into the kernel's view of the system.

Within the /proc/ directory, one can find a wealth of information detailing the system hardware and any processes currently running. In addition, some of the files within the /proc/ directory tree can be manipulated by users and applications to communicate configuration changes to the kernel.

From: http://www.redhat.com/docs/manuals/l...e/ch-proc.html
Check your 'dmesg' output, if your USB disk is detected successfully, it should display as sdX (X is either a, b, c, ... depend on your system configuration).

syg00 10-09-2007 06:03 AM

Simpler yet - enter (as root) "fdisk -l" in a terminal.
It'll tell you all the disks/partitions you have available to you.

Leave /proc alone - there are some writeable files there, but not what you're trying to do.

ic_torres 10-09-2007 06:04 AM

oh i see.. im sorry :(

here is the output of /var/log/messages :

Oct 9 19:10:30 darkstar kernel: usb 1-4: new high speed USB device using ehci_hcd and address 58
Oct 9 19:10:31 darkstar kernel: usb 1-4: new high speed USB device using ehci_hcd and address 59
Oct 9 19:10:31 darkstar kernel: usb 1-4: new high speed USB device using ehci_hcd and address 60
Oct 9 19:10:32 darkstar kernel: usb 1-4: new high speed USB device using ehci_hcd and address 61
Oct 9 19:10:32 darkstar kernel: usb 1-4: new high speed USB device using ehci_hcd and address 62


_____________________________________________

results of mount command :

/dev/hdc5 on / type reiserfs (rw)
proc on /proc type proc (rw)
sysfs on /sys type sysfs (rw)
usbfs on /proc/bus/usb type usbfs (rw)
/dev/hdc6 on /boot type ext3 (rw)
/dev/hdc8 on /tmp type reiserfs (rw)
/dev/hdc9 on /var type reiserfs (rw)
/dev/hdc10 on /usr type reiserfs (rw)
/dev/hdc11 on /home type reiserfs (rw)
/dev/hda1 on /mnt/windows type vfat (rw)
/dev/hda5 on /mnt/winback type vfat (rw)


_________________________________________________

when i type dmesg the same output shows :

dmesg | grep usb
usb 1-4: new high speed USB device using ehci_hcd and address 49
usb 1-4: new high speed USB device using ehci_hcd and address 50
usb 1-4: new high speed USB device using ehci_hcd and address 51
usb 1-4: new high speed USB device using ehci_hcd and address 52
usb 1-4: new high speed USB device using ehci_hcd and address 53
usb 1-4: new high speed USB device using ehci_hcd and address 54
usb 1-4: new high speed USB device using ehci_hcd and address 55
usb 1-4: new high speed USB device using ehci_hcd and address 56
usb 1-4: new high speed USB device using ehci_hcd and address 57
usb 1-4: new high speed USB device using ehci_hcd and address 58
usb 1-4: new high speed USB device using ehci_hcd and address 59

ic_torres 10-09-2007 06:07 AM

Quote:

Originally Posted by syg00 (Post 2918204)
Simpler yet - enter (as root) "fdisk -l" in a terminal.
It'll tell you all the disks/partitions you have available to you.

Leave /proc alone - there are some writeable files there, but not what you're trying to do.


sir the results :



Code:


fdisk -l

Disk /dev/hda: 41.1 GB, 41110142976 bytes
255 heads, 63 sectors/track, 4998 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

  Device Boot      Start        End      Blocks  Id  System
/dev/hda1  *          1        2449    19671561    c  W95 FAT32 (LBA)
/dev/hda2            2450        4998    20474842+  f  W95 Ext'd (LBA)
/dev/hda5            2450        4998    20474811    b  W95 FAT32

Disk /dev/hdc: 80.0 GB, 80026361856 bytes
16 heads, 63 sectors/track, 155061 cylinders
Units = cylinders of 1008 * 512 = 516096 bytes

  Device Boot      Start        End      Blocks  Id  System
/dev/hdc1              1      19376    9765472+  a6  OpenBSD
/dev/hdc2          19377      38752    9765504  83  Linux
/dev/hdc3          38753      58128    9765504  83  Linux
/dev/hdc4          58129      155061    48854232    5  Extended
/dev/hdc5          58129      62003    1952968+  83  Linux
/dev/hdc6          62004      62197      97744+  83  Linux
/dev/hdc7          62198      64135      976720+  82  Linux swap
/dev/hdc8          64136      66073      976720+  83  Linux
/dev/hdc9          66074      68011      976720+  83  Linux
/dev/hdc10          68012      77699    4882720+  83  Linux
/dev/hdc11          77700      97075    9765472+  83  Linux
/dev/hdc12        125998      155061    14648224+  83  Linux
/dev/hdc13          97076      125997    14576656+  83  Linux

Partition table entries are not in disk order
root@darkstar:~#


syg00 10-09-2007 06:25 AM

Erk - maybe the udev rules aren't right. Have a look at dmesg, and look for the device that gets allocated - probably sda. Should also show the partitions on the device.
Make some mountpoints and mount the partitions manually.

ic_torres 10-09-2007 06:37 AM

just wondering.. .when im using my usb flash disk. .the files resides at /mnt/vl-hot/sda/vol1

but when i tested the usb hd --- /mnt/vl-hot/sda/vol1 does not have any contents. . .

syg00 10-09-2007 06:48 AM

What does "df -hT" look like ???. After the flash is inserted, and after the USB is inserted.

ic_torres 10-09-2007 06:56 AM

Quote:

Originally Posted by syg00 (Post 2918229)
What does "df -hT" look like ???. After the flash is inserted, and after the USB is inserted.


Code:


USB hd  inserted --slackware 12.0

Filesystem    Type    Size  Used Avail Use% Mounted on
/dev/hdc5 reiserfs    1.9G  489M  1.4G  26% /
/dev/hdc6    ext3    93M  22M  66M  25% /boot
/dev/hdc8 reiserfs    954M  36M  919M  4% /tmp
/dev/hdc9 reiserfs    954M  58M  896M  7% /var
/dev/hdc10
          reiserfs    4.7G  3.3G  1.5G  70% /usr
/dev/hdc11
          reiserfs    9.4G  3.1G  6.3G  33% /home
/dev/hda1    vfat    19G  14G  5.1G  74% /mnt/windows
/dev/hda5    vfat    20G  12G  7.9G  60% /mnt/winback


my USB flash disk works with VL so here it is:

df -hT
Filesystem    Type    Size  Used Avail Use% Mounted on
/dev/hdc12
          reiserfs    14G  6.1G  8.0G  43% /
none        tmpfs    506M    0  506M  0% /dev/shm
/dev/hda1    vfat    19G  14G  5.1G  74% /mnt/windows
/dev/hda5    vfat    20G  12G  7.9G  60% /mnt/winbak
/dev/sda1    vfat    499M  176M  324M  36% /mnt/vl-hot/sda/vol1


USB hd using VL :

df -hT
Filesystem    Type    Size  Used Avail Use% Mounted on
/dev/hdc12
          reiserfs    14G  6.1G  8.0G  43% /
none        tmpfs    506M    0  506M  0% /dev/shm
/dev/hda1    vfat    19G  14G  5.1G  74% /mnt/windows
/dev/hda5    vfat    20G  12G  7.9G  60% /mnt/winbak



All times are GMT -5. The time now is 02:19 AM.