[SOLVED] Unable to own previously saved /home files on new external USB drive
Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Introduction to Linux - A Hands on Guide
This guide was created as an overview of the Linux Operating System, geared toward new users as an exploration tour and getting started guide, with exercises at the end of each chapter.
For more advanced trainees it can be a desktop reference, and a collection of the base knowledge needed to proceed with system and network administration. This book contains many real life examples derived from the author's experience as a Linux system and network administrator, trainer and consultant. They hope these examples will help you to get a better understanding of the Linux system and that you feel encouraged to try out things on your own.
Click Here to receive this Complete Guide absolutely free.
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:
/dev/sdb1 /media/disk ext4 noauto,rw 0 0
Here's what I've done to try and fix ownership already:
in /media I:
# chmod 775 disk
which gives output of:
media # ls -l
drwxrwxr-x 2 root root 4096 Nov 1 21:30 disk
and then tried
# chown -R tonyawards disk
(there is just me as a user on the computer, no groups)
no luck, so then I
# chown g+rwxs disk
although I don't really know what set-UID does...
It now reads:
media # ls -l
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.
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.
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->
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)
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.
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:
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.
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.