PCLinuxOS-Forums
News: ...FLASH!!! ...New PCLinuxOS Testing board now open. Register today! Be an active contributor to the PCLinuxOS future! ... Read all about it now, on THIS forum!!!..
 
*
Welcome, Guest. Please login or register. May 26, 2012, 10:18:31 PM


Login with username, password and session length


Pages: [1]   Go Down
  Print  
Author Topic: [SOLVED] Cannot write to new 2.5inch SATA drive  (Read 717 times)
besonian
Hero Member
*****
Offline Offline

Posts: 806


« on: August 09, 2010, 07:43:50 AM »

I've set up a new 120gb SATA 2.5inch drive in a USB enclosure. In Gparted I've created a single FS4 partition and formatted it. It appears on the desktop when I plug it in. When I go to change its permissions however so that I can write to it etc in my user account, I'm told - 'The permissions of "disk" could not be determined'. Root can however write to it and when, in my user account, I right click on the desktop icon, then left click on 'properties>permissions' - it tells me the owner is root and the group is root and - naturally therefore - I am not allowed to change permissions. I don't know what's going on here. Can somebody tell me?
Logged

We are here and it is now. Further than that all human knowledge is moonshine.
Ramchu
Hero Member
*****
Offline Offline

Posts: 1429



« Reply #1 on: August 09, 2010, 07:55:54 AM »

Can you go in as root and add your user to the group ?
Logged

pags
Hero Member
*****
Offline Offline

Posts: 1951


Keep it clean.


« Reply #2 on: August 09, 2010, 10:25:41 AM »

FS4 partition?

Do you mean ext4?

Anyway, I've done a number of external USB drives as ext3 and ext4.  The root (of the removable drive) doesn't have permissions, by default, to allow a regular user to do anything (unlike a FAT or VFAT external, which, when mounted by a regular user, has no concept of owners or permission WRT Linux, and allows everyone to do everything).

My fix is to, as root, create a folder (I use "public" as a name), and then set the permissions on that folder to allow everyone full access (chmod 777).  This creates an "open", unfettered area, as well as still allow the creation of restricted folders (if desired) at the same level as "public".
Logged
besonian
Hero Member
*****
Offline Offline

Posts: 806


« Reply #3 on: August 09, 2010, 10:40:30 AM »

Pags - thank you. Yes, FS4 was due to my brain getting scrambled by so many foiled attempts at solving this on my own. Yes - ext4. But you're ahead of me here - can you be a bit more specific? Do you mean that your 'public' folder becomes the destination for anything that you put in that drive - apart from anything you may want to restrict to 'root'? And that therefore that 'public' folder can, in theory, expand eventually to the capacity of the drive itself?
Logged

We are here and it is now. Further than that all human knowledge is moonshine.
besonian
Hero Member
*****
Offline Offline

Posts: 806


« Reply #4 on: August 09, 2010, 10:46:49 AM »

pags - having said the above, what's puzzling me most is that I have three other USB external drives (3.5inch), two of which are IDE and one SATA, and all of those have an ext3/4 file system. All I had to do on any of them to allow my user account to write to them was as root, to change the permissions. But as I say, on this drive,I'm told that the permissions of this "disk" could not be determined. That sounds odd to my untutored ear. Or not?

Edit - since the above I've tried your fix as per my own interpretation and voila! - it works. Thank you. However I'm not marking this as solved yet until I can get some solution to the question above - how come other three drives haven't needed any sort of fix?


Ramchu - I guess your response was superseded by pags' before I could get around to replying to you. Thank you anyway for the input.
Logged

We are here and it is now. Further than that all human knowledge is moonshine.
pags
Hero Member
*****
Offline Offline

Posts: 1951


Keep it clean.


« Reply #5 on: August 09, 2010, 11:00:28 AM »

Pags - thank you. Yes, FS4 was due to my brain getting scrambled by so many foiled attempts at solving this on my own. Yes - ext4. But you're ahead of me here - can you be a bit more specific? Do you mean that your 'public' folder becomes the destination for anything that you put in that drive - apart from anything you may want to restrict to 'root'? And that therefore that 'public' folder can, in theory, expand eventually to the capacity of the drive itself?

That is exactly correct!

Since it's just a folder (directory) on the drive, without any file-system constraints regarding size, it generally becomes the biggest folder on it...

Hold on a sec...

There.  I just plugged in my newest drive.  I re-partitioned it when I got it:
Code:
Disk /dev/sdb: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x8d399bc0

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1   *           1        1305    10482381    c  W95 FAT32 (LBA)
/dev/sdb2            1306       60801   477901620    5  Extended
/dev/sdb5            1306        7832    52428096   83  Linux
/dev/sdb6            7833       60801   425473461   83  Linux

It's a WD 500GB drive.  I shrunk the VFAT partiton down to 10Gb (so it could still be plugged into a Windows machine with getting the ext file-systems trashed).
I then added a 50GB partition (I have plans to install PCLOS on there, so it can be moved from PC to PC ... I'm doing that now with a 20GB HDD, but it's space limited  Grin); and the balance (~400GB is another ext4 partition labeled Data:
Code:
df
Filesystem            Size  Used Avail Use% Mounted on
/dev/sda7              21G   15G  4.8G  76% /
tmpfs                1001M     0 1001M   0% /dev/shm
/dev/sda6             251G  226G   25G  91% /media/disk
/dev/sdb6             400G  302G   78G  80% /media/Data

Contents of Data:
Code:
ls /media/Data/ -lh
total 20K
drwx------ 2 root root  16K 2010-07-18 15:05 lost+found/
drwxrwxrwx 3 root root 4.0K 2010-07-18 15:09 public/

And space usage (as a normal user):
Code:
du /media/Data/ -hx --max-depth=1
du: cannot read directory `/media/Data/public/backup/var/www/web6/user/web6_admin/Maildir': Permission denied
du: cannot read directory `/media/Data/public/backup/var/www/web7/user/web7_admin/Maildir': Permission denied
du: cannot read directory `/media/Data/public/backup/var/www/web8/user/web8_admin/Maildir': Permission denied
302G    /media/Data/public
du: cannot read directory `/media/Data/lost+found': Permission denied
16K     /media/Data/lost+found
302G    /media/Data/

You'll notice I don't (as a regular user) have access to everything (because i copied some stuff as root from elsewhere  Shocked), but everything on that drive is in the "public" directory, at the moment...

...oh, you've posted again:
pags - having said the above, what's puzzling me most is that I have three other USB external drives (3.5inch), two of which are IDE and one SATA, and all of those have an ext3/4 file system. All I had to do on any of them to allow my user account to write to them was as root, to change the permissions. But as I say, on this drive,I'm told that the permissions of this "disk" could not be determined. That sounds odd to my untutored ear. Or not?

Edit - since the above I've tried your fix as per my own interpretation and voila! - it works. Thank you. However I'm not marking this as solved yet until I can get some solution to the question above - how come other three drives haven't needed any sort of fix?


Ramchu - I guess your response was superseded by pags' before I could get around to replying to you. Thank you anyway for the input.


It is possible to set the permissions at the drive level (via /etc/fstab, or mount options or other methods), but I find that more confusing, and it ends up being hit-and-miss for me.
I prefer to leave the root restricted, and create the folder as I've described.  That way, regardless of how, where or by whom the drive is mounted, there is a known location where things can be saved...

Also, if you leave it as VFAT, this probably will not be an issue in almost all cases...

Hope that helps, some. Undecided
Logged
besonian
Hero Member
*****
Offline Offline

Posts: 806


« Reply #6 on: August 09, 2010, 11:10:16 AM »

pags - thank you. I appreciate all that. If the fix continues to work for me - I can see no reason why it won't - then I'll stick with it. The system you describe would suite me perfectly. I'm afraid the permissions in Linux are largely a blind spot with me - and I suspect many others. I really should do a bit of homework on it. Anyway, many thanks once again. I appreciate the time you've taken.
Logged

We are here and it is now. Further than that all human knowledge is moonshine.
Old-Polack
Administrator
Hero Member
*****
Offline Offline

Posts: 9695


----IOFLU----


« Reply #7 on: August 09, 2010, 11:34:20 AM »

pags - thank you. I appreciate all that. If the fix continues to work for me - I can see no reason why it won't - then I'll stick with it. The system you describe would suite me perfectly. I'm afraid the permissions in Linux are largely a blind spot with me - and I suspect many others. I really should do a bit of homework on it. Anyway, many thanks once again. I appreciate the time you've taken.

If you want unrestricted access to any partition, mount it somewhere, then as root, in a terminal, use the chown (change owner) command;

[root@localhost ~]# chown -R <user>:<user> /<mountpoint>

Change <user> to the name of the user you want to own the partition, change <mountpoint> to the actual directory name, using the full path. Once this is done, the partition can be mounted anywhere and the <user> will still have full access.
Logged

Old-Polack

Of what use be there for joy, if not for the sharing thereof?



Lest we forget...
besonian
Hero Member
*****
Offline Offline

Posts: 806


« Reply #8 on: August 09, 2010, 12:01:48 PM »

Ah - OP - the man himself! Thank you. But then can I take the drive and plug it in another machine at another location? I work on three machines in two different locations and would want to be able to plug that drive into any one. My user name incidentally is the same on each machine.

Edit: - OK OP, I've done that and - as you say - I now have permission to write to anywhere on the drive. Thank you. In fact, chown is one of those commands I remember - and I'd tried it before I started this thread. However - I was putting in the wrong path to the drive. All it told me - not surprisingly - was that the path didn't exist. I assumed that along with the other things I didn't understand that there was some sinister problem lurking in the darkness.

Thanks everybody.
Logged

We are here and it is now. Further than that all human knowledge is moonshine.
pags
Hero Member
*****
Offline Offline

Posts: 1951


Keep it clean.


« Reply #9 on: August 09, 2010, 12:05:07 PM »

Ah - OP - the man himself! Thank you. But then can I take the drive and plug it in another machine at another location? I work on three machines in two different locations and would want to be able to plug that drive into any one. My user name incidentally is the same on each machine.

OP's approach will work fine, as long as the UID is the same on all the systems (or you don't have any additional user's on any of the systems).

That's why I use my approach (just preference), multiple machines with multiple users, and LiveCds, and other people's PCs (yadda, yadda, yadda)...

Definitely go with what works...also, good to be aware of alternate approaches, so you can make an informed decision.
Logged
besonian
Hero Member
*****
Offline Offline

Posts: 806


« Reply #10 on: August 09, 2010, 12:16:27 PM »

pags - as you say, go with what works. If doing it this way gives me problems such as you describe - and I'll figure that out within the next 24 hours - then I'll revert to the 'Public' folder. But I do need to get a far better handle on this sort of thing than I have at present. It's about the only thing in Linux that occasionally drives me up the brickwork.
Logged

We are here and it is now. Further than that all human knowledge is moonshine.
Old-Polack
Administrator
Hero Member
*****
Offline Offline

Posts: 9695


----IOFLU----


« Reply #11 on: August 09, 2010, 12:21:23 PM »

Ah - OP - the man himself! Thank you. But then can I take the drive and plug it in another machine at another location? I work on three machines in two different locations and would want to be able to plug that drive into any one. My user name incidentally is the same on each machine.

As pags points out, the user name is not as critical as the UID/GID numbers. I have various user names on different installations, but all my "names" have the same UID/GID ie 1000/1000. It doesn't matter which installation I boot, All my data is owned by 1000/1000 so it is automatically translated as being owned by the current user name.

As to other machines being able to use the USB drive, I'm running this installation from the USB drive, so the OS moves with the drive. It is currently hooked up to a machine that can't boot from USB, but as I have a boot partition on the internal drive, I copied the /boot directory of this installation to that boot drive, named it minime2010 and boot from the kernel contained therein.

title MiniMe 2010
kernel (hd0,0)/minime2010/vmlinuz BOOT_IMAGE=MiniMe_2010 root=LABEL=minime2010  resume=LABEL=swap1000 vga=791
initrd (hd0,0)/minime2010/initrd.img


Having labeled the / partition minime2010 also, the device designation is of no concern, the proper partition is always the one that boots.  Cheesy
Logged

Old-Polack

Of what use be there for joy, if not for the sharing thereof?



Lest we forget...
besonian
Hero Member
*****
Offline Offline

Posts: 806


« Reply #12 on: August 09, 2010, 12:35:14 PM »

OK, OP - well, that's going to take me a few seconds to get my head around. But I sort of get where you're coming from. I'm going to print that message out and try to get a better handle on this sort of thing. As I said, it's the only thing in Linux that has me tearing what hair I've got left out from time to time. Thank you - I shall now mark this as solved.
Logged

We are here and it is now. Further than that all human knowledge is moonshine.
Old-Polack
Administrator
Hero Member
*****
Offline Offline

Posts: 9695


----IOFLU----


« Reply #13 on: August 09, 2010, 12:42:20 PM »

OK, OP - well, that's going to take me a few seconds to get my head around. But I sort of get where you're coming from. I'm going to print that message out and try to get a better handle on this sort of thing. As I said, it's the only thing in Linux that has me tearing what hair I've got left out from time to time. Thank you - I shall now mark this as solved.

What I posted was just a quick overview. If you'd like more details, at any time, start a new thread dedicated to that subject, and I'll take you through a step by step set up procedure. I'll even toss in a few screen shots if you'd like.  Grin
Logged

Old-Polack

Of what use be there for joy, if not for the sharing thereof?



Lest we forget...
besonian
Hero Member
*****
Offline Offline

Posts: 806


« Reply #14 on: August 09, 2010, 02:39:57 PM »

OP - that would be brilliant. Can't do that right now, but I'll get round to it tomorrow. Thank you.
Logged

We are here and it is now. Further than that all human knowledge is moonshine.
Pages: [1]   Go Up
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.16 | SMF © 2011, Simple Machines

Valid XHTML 1.0! Valid CSS! Dilber MC Theme by HarzeM