PDA

View Full Version : [ubuntu] [SOLVED] Cannot change ownership of HDD



TheMemphisExperience
May 23rd, 2008, 12:27 AM
I was having some trouble mounting an internal HDD yesterday. When that was resolved, I noticed I could not mount from the GUI as it belonged to root.

I decided to handle it the next day. That day is today.

I went in and looked up how to use the chown tag in terminal. Well, it didn't do me too much good.


sudo chown -R omegapie:omegapie /media/win/*

I tried that code to attempt to gain ownership. Even as root, it said the permission was denied. Before that I navigated to the directory and said


sudo chown omegapie:omegapie *

but the permission was denied.

I think the answer might be in fstab.


# /etc/fstab: static file system information.
#
# -- This file has been automaticly generated by ntfs-config --
#
# <file system> <mount point> <type> <options> <dump> <pass>

proc /proc proc defaults 0 0
# Entry for /dev/sda1 :
UUID=5e2c39c2-7436-409d-b209-83951d63ed74 / ext3 defaults,errors=remount-ro 0 1
# Entry for /dev/sda5 :
UUID=f8b6fa2d-d41c-49f6-b871-047fcadac0da none swap sw 0 0
/dev/scd0 /media/cdrom0 udf,iso9660 user,noauto,exec 0 0
/dev/fd0 /media/floppy0 auto rw,user,noauto,exec 0 0
/dev/sdb1 /media/win vfat defaults 0 0


In order to get the HDD to mount,


/dev/sdb1 /media/win vfat defaults 0 0

was added to the end.


# Entry for /dev/sda5 :
UUID=f8b6fa2d-d41c-49f6-b871-047fcadac0da none swap sw 0 0

Refers to the second internal HDD, but something must have gone wrong as it would not mount with that line. If that one could be fixed, then perhpas this could have some kind of useful resolution as I cannot write to the HDD unless root.

I don't really know how to do that(though I should), nor am I inclined to do so whenever I need to modify the drive.

Thanks for any help.

TheMemphisExperience
May 23rd, 2008, 02:56 AM
Any leads?

Patb
May 23rd, 2008, 05:37 AM
Memphis, I'm not sure whether I've understood you correctly but "/dev/sda5" is not your second internal HDD but a swap partition on your first HDD. It looks fine as is. Your second HDD is /dev/sdb and its first partition is /dev/sdb1.

Try looking at the partition information. In a terminal:

sudo fdisk -l
Also check the uuids for your partitions:

sudo blkid
Make sure the uuids in fstab match the correct ones listed by blkid.

It's still not clear why your second HDD is not mounting though. I would have thought your line "/dev/sdb1 /media/win vfat defaults 0 0" was correct.

If you can't work it out, post the output of the above commands, and perhaps:
ls -l /media/Cheers, Pat

TheMemphisExperience
May 24th, 2008, 02:54 AM
The filesystem will mount, but only with "dev/sdb1 media/win...etc". The UUIDs are correct in sda5, but it simply will not mount without the modified fstab. Before, it had worked just fine.

I've changed some things to try to restore the old behavior, but no good.

Using the modified fstab enables mounting, but the filesystem belongs to root, which is no good as I cannot modify the drive with the GUI.

This is what fdisk says


total 28
lrwxrwxrwx 1 root root 6 2008-04-08 21:37 cdrom -> cdrom0
drwxr-xr-x 2 root root 4096 2008-04-08 21:37 cdrom0
lrwxrwxrwx 1 root root 7 2008-04-08 21:37 floppy -> floppy0
drwxr-xr-x 2 root root 4096 2008-04-08 21:37 floppy0
drwxr-xr-x 4 root root 16384 2008-05-23 22:03 win
drwxr-xr-x 2 root root 4096 2008-05-21 23:42 Win

bodhi.zazen
May 24th, 2008, 03:30 AM
With windows file systems (FAT / NTFS) ownership and permissions are set at the time of mount.


sudo umount /dev/sdba

Now edit fstab :


/dev/sdb1 /media/win vfat users,uid=1000,gid=1000,dmask=027,fmask=137 0 0

Now:


mount /media/win

See : http://ubuntuforums.org/showthread.php?&t=283131

TheMemphisExperience
May 24th, 2008, 04:04 AM
You are my hero! Thank you very much, it works as it should.

I'll be reading that guide now.