Mounting a backup partition and using it as a user

I have two HDs in my computer, one of which has about 400 GB of unpartitioned space. I’m trying to create a partition on that disk that I can use as a “backup” partition for /home using something like rsync. However, I can’t seem to get the partition created correctly. What I’d like is to have it read/writable by both root and my normal user account, so I can run rsync in a cron job in the middle of the night. I’m using Yast to format the space to ext2, with the “mount as user” option, gid=users, and a mount point of /media/backup. It seemingly works, until I try something like cp foo.bar /media/backup. I don’t have permissions to create the file. So, I open up /etc/fstab and everything looks good. Ok, umount -a as root. Then mount -a as root. I get an error:

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

Relevant part of fstab:

/dev/disk/by-id/scsi-SATA_ST3500630AS_9QG5P7MY-part4 /media/backup        ext2       defaults,auto   0 0

I have a feeling that this is an easy fix, but I’m not coming up with it. Still a Linux baby. What is it that I’m not doing?

–chriscrutch

Hi
Create a subdirectory under backup owned by you, then run your backup
rsync as a cron job created by you. I’m assuming your the only user?


sudo /bin/mkdir /media/backup/myusername
sudo /bin/chown myusername:users /media/backup/myusername
chmod 755 /media/backup/myusername

Note myusername is an example.


Cheers Malcolm °¿° (Linux Counter #276890)
openSUSE 11.0 x86 Kernel 2.6.25.16-0.1-default
up 2 days 6:16, 1 user, load average: 0.08, 0.08, 0.07
GPU GeForce 6600 TE/6200 TE - Driver Version: 173.14.12

Thanks, Malcolm. I’m not actually the only user. Will I have to modify your code? I’ll be sure to try your suggesion later, but I’m afraid I may not have been clear with my original post. Getting write access as a user is now only half of my problem. The other half is that I can’t even get the partition mounted. I get the error from my original post when trying to mount. Even a reboot won’t mount the partition.

–chriscrutch

Hi
I would use YaST partitioner to setup the drive (MAKE SURE YOU SELECT
THE CORRECT DRIVE! :slight_smile: ) if you then hit the fstab button you can tick
the box to mount at boot and it will create the fstab entry.

Yes just create the directories under the username and chown to
username:users etc.


Cheers Malcolm °¿° (Linux Counter #276890)
openSUSE 11.0 x86 Kernel 2.6.25.16-0.1-default
up 4:15, 1 user, load average: 0.04, 0.07, 0.06
GPU GeForce 6600 TE/6200 TE - Driver Version: 173.14.12

IMO you should check that /media/backup (I suppose root is the owner) is read/write/searchable for the world. Else a normal user is not alowed to write any file in it. That has nothing to do with mounting. Is always the case.

BTW, I should be carefull using umount -a. It unmounts all filesystems (though it will refuse to do so when they are in use) and I doubt if that is what you want.

I was right. It was a simple thing. I was trying to mount the drive with the command:

# mount /dev/sda4

I should have been using:

# mount /dev/sda4 /media/backup

I’m not sure why I need the mount point in the command, since the mount point is defined in fstab, but it seems that I do need to specify it when mounting manually. Once I got the disk mounted, I followed Malcolm’s advice, chown-ed and chmod-ed things around, and now all works as I was looking for.

And thanks to hcw for the advice about umount -a. You’re right, it was overkill for what I needed to do.

Thanks again, guys.

–chriscrutch

I can explain that. In your fstab there is no /dev/sda4 so you could have done

mount /media/backup

or

mount /dev/disk/by-id/scsi-SATA_ST3500630AS_9QG5P7MY-part4

In both cases mount would have found the rest it needs in /etc/fstab.

That makes sense. Thanks, hcvv.

–chriscrutch