Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Error mounting symlink'ed partitions
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware
View previous topic :: View next topic  
Author Message
bertaboy
l33t
l33t


Joined: 05 Nov 2004
Posts: 604

PostPosted: Fri May 23, 2008 4:11 pm    Post subject: Error mounting symlink'ed partitions Reply with quote

I have an external hard drive that I'm trying to create a perminent device node for. So I created /etc/udev/rules.d/99-freeagent and put the following in there:

Code:
# cat /etc/udev/rules.d/99-freeagent.rules
#ACTION=="add", SUBSYSTEM=="scsi_device", ATTRS{vendor}=="Seagate*", ATTRS{model}=="FreeAgent*" , SYMLINK+="freeagenthd%n"
BUS=="usb", KERNEL=="sd*", NAME="%k", ATTRS{serial}=="            9QM0XTKL", SYMLINK="freeagent-sda%n"


The links are created as shown here:

Code:
# ls -l /dev/freeagent-sda*
lrwxrwxrwx 1 root root 3 2008-05-23 05:47 /dev/freeagent-sda -> sdd
lrwxrwxrwx 1 root root 4 2008-05-23 05:47 /dev/freeagent-sda1 -> sdd1
lrwxrwxrwx 1 root root 4 2008-05-23 05:47 /dev/freeagent-sda2 -> sdd2
lrwxrwxrwx 1 root root 4 2008-05-23 05:47 /dev/freeagent-sda3 -> sdd3


I can mount the first partition, which happens to be in ntfs, but the second and third partitions are ext2. Here are the results from trying to mount by calling either the links or the mountpoints:

Code:
# mount /dev/freeagent-sda1
# mount /dev/freeagent-sda2
mount: wrong fs type, bad option, bad superblock on /dev/sdd2,
       missing codepage or helper program, or other error
       In some cases useful info is found in syslog - try
       dmesg | tail  or so

# mount /dev/freeagent-sda3
mount: wrong fs type, bad option, bad superblock on /dev/sdd3,
       missing codepage or helper program, or other error
       In some cases useful info is found in syslog - try
       dmesg | tail  or so


# mount /mnt/FreeAgent-1/

# mount /mnt/FreeAgent-2/
mount: wrong fs type, bad option, bad superblock on /dev/sdd2,
       missing codepage or helper program, or other error
       In some cases useful info is found in syslog - try
       dmesg | tail  or so

# mount /mnt/FreeAgent-3
mount: wrong fs type, bad option, bad superblock on /dev/sdd3,
       missing codepage or helper program, or other error
       In some cases useful info is found in syslog - try
       dmesg | tail  or so


However, if I mount via /mnt/sdd*, all of the mounts go through.

/etc/fstab:
Code:
/dev/freeagent-sda1   /mnt/FreeAgent-1   auto      user,rw,noauto,umask=007   0 0
/dev/freeagent-sda2   /mnt/FreeAgent-2   ext2      user,rw,noauto,umask=007   0 0
/dev/freeagent-sda3   /mnt/FreeAgent-3   ext2      user,rw,noauto,umask=007   0 0


I know I should be able to change the ext2 entries to auto in fstab, but I'm just trying to rule out problems right now. The problem persists if I replace ext2 with auto.

And here is the dmesg | tail that the above calls for:
Code:
# dmesg | tail
ACPI: PCI Interrupt 0000:01:00.0[A] -> GSI 16 (level, low) -> IRQ 16
PCI: Setting latency timer of device 0000:01:00.0 to 64
[drm] Initialized radeon 1.28.0 20060524 on minor 0
[drm] Used old pci detect: framebuffer loaded
[drm] Setting GART location based on new memory map
[drm] Loading R300 Microcode
[drm] writeback test succeeded in 1 usecs
FAT: invalid media value (0x7c)
VFS: Can't find a valid FAT filesystem on dev sda2.
NTFS volume version 3.1.


Any ideas?
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 54830
Location: 56N 3W

PostPosted: Fri May 23, 2008 5:53 pm    Post subject: Reply with quote

bertaboy,

Don't make symlinks, use
Code:
NAME="freeagent%n"
and get real device nodes /dev/freeagent...

I have
Code:
# all block devices
SUBSYSTEM=="block", GROUP="disk"

# disk devices
# KERNEL=="sd*",          NAME="%k", GROUP="disk"

SYSFS{product}=="DatawriteVoyager",             SYSFS{manufacturer}=="Pendrive",        SYSFS{serial}=="173426667658"   NAME="pendrive"
SYSFS{product}=="HP PhotoSmart 318 Camera",     SYSFS{manufacturer}=="Hewlett-Packard",                                 NAME="camera%n"

in /etc/udev/rules.d/12-removable-storage.rules for my USB storage devices. This dates from the days when your rules needed to be processed before the defualt ones at 50-
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
bertaboy
l33t
l33t


Joined: 05 Nov 2004
Posts: 604

PostPosted: Fri May 23, 2008 9:25 pm    Post subject: Reply with quote

NeddySeagoon wrote:
bertaboy,

Don't make symlinks, use
Code:
NAME="freeagent%n"
and get real device nodes /dev/freeagent...

I have
Code:
# all block devices
SUBSYSTEM=="block", GROUP="disk"

# disk devices
# KERNEL=="sd*",          NAME="%k", GROUP="disk"

SYSFS{product}=="DatawriteVoyager",             SYSFS{manufacturer}=="Pendrive",        SYSFS{serial}=="173426667658"   NAME="pendrive"
SYSFS{product}=="HP PhotoSmart 318 Camera",     SYSFS{manufacturer}=="Hewlett-Packard",                                 NAME="camera%n"

in /etc/udev/rules.d/12-removable-storage.rules for my USB storage devices. This dates from the days when your rules needed to be processed before the defualt ones at 50-


Okay, so I've renamed my .rules file to 12-removable-storage.rules, just to be consistent with what you have (although it sounds like that part was unneccessary).

Code:
# cat 12-removable-storage.rules
# all block devices
SUBSYSTEM=="block", GROUP="disk"

# disk devices
# KERNEL=="sd*",   NAME="%k", GROUP="disk"

SYSFS{product}=="FreeAgentDesktop", SYSFS{manufacturer}=="Seagate", SYSFS{serial}=="            9QM0XTKL", NAME="freeagent-sda%n"


Now there is no /dev/sdc or /dev/sdd that corresponds to the device, as it is now called /dev/freeagent-sda, along with the 3 partitions. This is all fine & dandy.

However:

My original problem still stands. Here is the current situation:
(1)Only freeagent-sda1 automounts and plays nice with fstab. -sda2 and -sda3 do not.
(2)I am able to mount all freeagent-sda{1,2,3} as root using "mount {device} {mountpoint}"
(3)Only -sda1 mounts with either the command "mount {device}" or "mount {mountpoint}"
Failures for (3) result in the following error:
Code:
mount: wrong fs type, bad option, bad superblock on /dev/freeagent-sda2,
       missing codepage or helper program, or other error
       In some cases useful info is found in syslog - try
       dmesg | tail  or so
Back to top
View user's profile Send private message
bertaboy
l33t
l33t


Joined: 05 Nov 2004
Posts: 604

PostPosted: Fri May 23, 2008 9:42 pm    Post subject: Additional: Reply with quote

Okay, additionally, I've removed the entries from /etc/fstab and here are some outputs:

Code:
# df -h
Filesystem            Size  Used Avail Use% Mounted on
...
/dev/freeagent-sda2    76G   52M   72G   1% /media/disk
/dev/freeagent-sda1    96G   68M   96G   1% /media/disk-1
/dev/freeagent-sda3   290G   63M  275G   1% /media/disk-2


Code:
# ls -l /media/
total 12
drwxr-xr-x 3 root root  4096 2008-05-23 15:41 disk
drwxrwxrwx 1 root root  4096 2008-05-23 13:12 disk-1
drwxr-xr-x 3 root root 4096 2008-05-23 15:44 disk-2


And, once again:

/dev/freeagent-sda2 76G 52M 72G 1% /media/disk <==ext2
/dev/freeagent-sda1 96G 68M 96G 1% /media/disk-1 <==ntfs
/dev/freeagent-sda3 290G 63M 275G 1% /media/disk-2 <==ext2

So somewhere my problem lies with not wanting to give users write permissions for ext2 filesystems automatically....


Edit:

I've temporarily resolved this issue by chmodding the mountpoints 777, since that's what the settings were for my NTFS mountpoint. However, I have a feeling that if I plug this drive into another Linux computer, the permissions for the drive will be scrambled in the perspective of the other computer. I understand that UID's are unique to each computer, so I guess this may be the most universal access I can provide for this drive: if I connect it to another computer, I guess I'll have to chmod the mount points on that computer to 777 in order to write, as well....

Additionally:

I can drag & drop, as well as copy, move, and delete files via the command prompt. However, whenever I right-click on any files via Nautilus, the options to cut, link, move to trash, and delete are all grey'ed out, as is any option to paste. Anyone know what's up with this? Using Gnome 2.20.3 here
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 54830
Location: 56N 3W

PostPosted: Sat May 24, 2008 12:52 pm    Post subject: Reply with quote

bertaboy,

The filenames in /etc/udev/rules.d/ are not important. They are all used. They are processed in the sort order, hence the numbers on the front. e.g. 50- That makes the sort order imeadately apparent to sysadmins.

Symlinks don't work for fixing permissions as the permissions on a symlink are not used for anything. The permissions on the reference object are always used.

User IDs vary from system to system depending on the order usernames are created in and different distros use different starting points for user IDs too.

For portability, you need to make your udev rules set the permissions on the mount point. However you cannot do that with ext2.
Linux supports faking linux permissions on file system types like ntfs, fat etc. that do not support linux permissions. However, that does not extend to ext2 and others that are linux permissions aware.

What are you attempting to achieve?
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
bertaboy
l33t
l33t


Joined: 05 Nov 2004
Posts: 604

PostPosted: Sat May 24, 2008 4:27 pm    Post subject: Reply with quote

NeddySeagoon wrote:
bertaboy,

The filenames in /etc/udev/rules.d/ are not important. They are all used. They are processed in the sort order, hence the numbers on the front. e.g. 50- That makes the sort order imeadately apparent to sysadmins.

Symlinks don't work for fixing permissions as the permissions on a symlink are not used for anything. The permissions on the reference object are always used.

User IDs vary from system to system depending on the order usernames are created in and different distros use different starting points for user IDs too.

For portability, you need to make your udev rules set the permissions on the mount point. However you cannot do that with ext2.
Linux supports faking linux permissions on file system types like ntfs, fat etc. that do not support linux permissions. However, that does not extend to ext2 and others that are linux permissions aware.

What are you attempting to achieve?


I knew as much about UID's being system-specific wrt a name/group getting mapped to a number.

What I'm trying to accomplish: having the hard drive be r/w by all users on any machine. The one problem I feel I'm facing, and don't know if I can overcome it (or if it's a per-machine issue), is if I plug this external into another Linux computer, will the whole thing have r/w permissions? Or only the files and subdirectories, but not the unit's base directory (i.e. on machine 2, I'm fairly sure that /media/{partition}/subdirectory is going to have permissions 777, but is /media/{partition} going to have 777? Or will it only have 550, with root being the owner?)

Also, apparently my copy & paste issue with Nautilus is gone, mysteriously....
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 54830
Location: 56N 3W

PostPosted: Sat May 24, 2008 6:05 pm    Post subject: Reply with quote

bertaboy,

Drives are not assigned permissions (well they are is you count /dev/sda etc.) File systems (and their contents) are.
For ntfs, permissions are assigned at mount time, since ntfs does not support Linux permissions.
Use the umask=0 option to give everyone full access to everything. Thats setting rwxrwxrwx on every file in the filesystem.

For ext2, permissions are assigned at file create time. You cannot globally change all the permissions, well I suppose you can do
Code:
chmod 777 -R /path/to/files
but thats a very dangerous command. Doing it wrong will require you reinstall your system.
If you choose that, you will want to do it from the safety of a liveCD with everything else not mounted.
That only fixes exiting files. New files will belong to whoever creates them.

What about creating a new group, say usbshare and putting all the files on the USB ext fielsystem in that group and adding users to have access to the files to the usbshare group?
That way, users have access due to their group membership
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum