LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Unable to own previously saved /home files on new external USB drive (https://www.linuxquestions.org/questions/linux-newbie-8/unable-to-own-previously-saved-home-files-on-new-external-usb-drive-842016/)

tonyawards 11-02-2010 09:13 PM

Unable to own previously saved /home files on new external USB drive
 
I have just had to reinstall my OS (Sabayon) onto a new and larger hard drive (dying old disk). I quickly saved all my old docs in /home on an external USB drive (formatted and then created an ext4 file system) before the swap and installation.


After getting the new disk running I connected the USB external disk. First I could not access the drive at all, but that seems to be fixed. Now I want to bring all my files back to my new /home folder but apparently they (especially the former MS Office .doc, .xls, etc files, not so much the OpenOffice files) are “read only” and I don't have permissions anymore.


I am able to create directories on the external, and can move files back and forth, but don't seem to own many of them.


Sabayon automatically mounted my external disk in /media/disk, rather than /mnt, so I've left that alone for now.


After searching here and elsewhere for info, I tried a few things (below):


For access I added a line to /etc/fstab:
Code:

/dev/sdb1  /media/disk  ext4  noauto,rw  0  0
Here's what I've done to try and fix ownership already:


in /media I:
Code:

# chmod 775 disk
which gives output of:

Code:

media # ls -l
 total 4
 drwxrwxr-x 2 root root 4096 Nov  1 21:30 disk

and then tried


Code:

# chown -R tonyawards disk
(there is just me as a user on the computer, no groups)
no luck, so then I


Code:

# chown g+rwxs disk
although I don't really know what set-UID does...


It now reads:

Code:

media # ls -l
 total 4
 drwxrwsr-x 2 root root 4096 Nov  1 21:30 disk

I thought that the “-R” would give full access to all directories and their files as an owner, therefore allowing me to modify them at will. But apparently not.


I'm not sure what the “total 4” refers to since there is only the one directory “disk” inside /media but I assume that's not part of this issue... Does adding umask=0 have anything to do with this, and if so where does that go?


Hopefully this is all clear to someone – Linux is still pretty new to me. What am I missing/doing wrong? Please tell me that it's possible to change these files so I can “own” them again.


Thank you all. Any other output you might need, please let me know.

tommyttt 11-03-2010 12:49 AM

Hi Tonyawards:)

I'm not familiar with Sabyon but some ideas to try.

In /etc/fstab you're showing a mount point of /media/disk but elsewhere you just show disk. Try changing the chown to point at /media/disk (make sure it exists before issuing the command). Thr -R option does recurse from the specified directory to the subdirectories.

Try copying the files to their final destination and then performing the chown.

Tom

martinbc 11-03-2010 03:35 AM

Hi

The "total 4" line gives the size in blocks of the files and directories listed.
If you want a more friendly line add h to parameters for ls
Code:

ls -lh
Martin

jv2112 11-03-2010 03:46 AM

Try -->

chown -R tonyawards /dev/sdb1

If your mount point is incorrect this will change it directly.


You can also run mount and see where the drive is at. The re run the command.Example below->



Quote:


joe@Tux-Box ~ $ mount

/dev/sda3 on / type ext4 (rw,errors=remount-ro,commit=0)
/dev/sda1 on /boot type ext4 (rw,commit=0)
/dev/sdb1 on /media/N-Space type ext4 (rw,commit=0)
/dev/sdc1 on /media/DDD-Show type ext4 (rw,commit=0)
/dev/sdd1 on /media/E-Space type ext4 (rw,commit=0)



:twocents:

tonyawards 11-03-2010 11:13 PM

jv2112, I ran mount and got what seems to me to be an odd result on the last line. It's sure not what you have in your various /media locations.
Code:

# mount
rootfs on / type rootfs (rw)
/dev/sda1 on / type ext4 (rw,commit=0)
proc on /proc type proc (rw,relatime)
rc-svcdir on /lib64/rc/init.d type tmpfs (rw,nosuid,nodev,noexec,relatime,size=1024k,mode=755)
sysfs on /sys type sysfs (rw,relatime)
securityfs on /sys/kernel/security type securityfs (rw,nosuid,nodev,noexec,relatime)
udev on /dev type tmpfs (rw,nosuid,relatime,size=10240k,mode=755)
devpts on /dev/pts type devpts (rw,relatime,gid=5,mode=620)
tmpfs on /dev/shm type tmpfs (rw,relatime)
/dev/sda2 on /home type ext4 (rw,commit=0)
usbfs on /proc/bus/usb type usbfs (rw,noexec,nosuid,devmode=0664,devgid=85)
nfsd on /proc/fs/nfsd type nfsd (rw,noexec,nosuid,nodev)
binfmt_misc on /proc/sys/fs/binfmt_misc type binfmt_misc (rw,noexec,nosuid,nodev)
/dev/sdb1 on /media/disk type ext4 (rw,noexec,nosuid,nodev,user=spike)

Does noexec mean what I think it might mean in that last line for sdb1, and if so, how do I fix these settings to make them correct for what I need? My /home and root on sda2 and sda1 are the only ones that are set as yours are, eg: (rw,commit=0).

tommyttt - my mount point is in /media/disk; I just grabbed part of my terminal output while I was in my /media directory. I re-did it to make sure (~# chown -R tonyawards /media/disk), but the file permssions are remaining read-only. When I bring a file over to my Desktop the permissions stay the same and it remains a read-only file.

And martinbc, thanks for that clarification on the totals number.

I just ran a ls -l in /dev to have a look, and without posting it all, some entries also seem strange:

Code:

drwxr-xr-x  5 root  root      100 Nov  3 18:47 disk
 - and -
lrwxrwxrwx  1 root  root        4 Nov  3 18:47 root -> sda1
lrwxrwxrwx  1 root  root        4 Nov  3 18:47 rtc -> rtc0
crw-rw----  1 root  root  254,  0 Nov  3 18:47 rtc0
lrwxrwxrwx  1 root  root        3 Nov  3 18:47 scd0 -> sr0
brw-rw----  1 root  disk    8,  0 Nov  3 18:47 sda
brw-rw----  1 root  disk    8,  1 Nov  3 18:47 sda1
brw-rw----  1 root  disk    8,  2 Nov  3 18:47 sda2
brw-rw----  1 root  disk    8,  3 Nov  3 18:47 sda3
brw-rw----  1 root  disk    8,  16 Nov  3 18:56 sdb
brw-rw----  1 spike disk    8,  17 Nov  3 18:56 sdb1

Are these normal permissions or does disk seem odd as a 755 when I gave it a 775 permission (I thought, with chmod)?

Thanks everyone, for all the detailed suggestions so far, and for any others you may have... I'm still at a bit of a loss here.

JZL240I-U 11-04-2010 02:04 AM

Code:

/dev/sdb1 on /media/disk type ext4 (rw,noexec,nosuid,nodev,user=spike)
I'd suggest you delete that entry...

jv2112 11-04-2010 04:10 AM

I am a little stumped. Did you SU/Sudo (I am not familiar w/ your distro) when you chmod ?

tonyawards 11-09-2010 09:16 PM

jv2112, yes I was in 'su' when I tried these changes, but still it was not working.

I had to rename each master directory in my /home file system on the external drive one by one, just slightly, in order to be able to chmod -R the permissions to 775 on all. I also had to remove any spaces from the directory names, which I have never have had to do before (dog food to dog_food etc). When they were finally done they would then copy over to my new installed hard drive and went into /home with no trouble.

Now on the new installed drive, all directories are at 755 and files inside have remained at 775. This seems fine for now (I'm the only one with access to this box) until I am sure all is ok, then I'll reduce permissions just for safety's sake.

JZL240I-U, thanks for the catch – I did change that entry from spike to tonyawards (older user) first, but it still did not allow me to do what I mentioned above.

I wish I had a more elegant fix to report here, but this did at least work. So I'll mark this as solved, and thank you all for your time and input.


All times are GMT -5. The time now is 06:08 PM.