Page 1 of 1

Creating Loopback Device

Posted: Tue Jul 02, 2013 4:38 am
by BMW
Hi all,

I am following the intstructions on here: http://wiki.osdev.org/Loopback_Device to mount my hard disk image.

I have a file, os.img, which is 16MiB in size. It is formatted with the FAT16 filesystem. I use this command to create loopback device:

Code: Select all

sudo losetup /dev/loop0 os.img
Then I mount the loopback device with this:

Code: Select all

sudo mount -t msdos /dev/loop0 OSDrive
Then if I try to paste files into the OSDrive folder, I get this:
Image

How can I fix this?

Re: Creating Loopback Device

Posted: Tue Jul 02, 2013 4:48 am
by escortkeel
You are going to want to give your file browser root permissions. Perhaps try invoking it at the terminal, prefixed with "sudo".

Re: Creating Loopback Device

Posted: Tue Jul 02, 2013 6:05 am
by iansjack
Using root when you don't need to is dangerous ; doubly so if that use is to run a file browser. Far better, IMO, to just change the permissions on the root directory. This is pretty basicc Unix stuff.

Re: Creating Loopback Device

Posted: Tue Jul 02, 2013 7:36 am
by Nable
man mount
/vfat
Then you'll find how to set uid/gid (as FAT* FSs don't support unix ids/gids) for all files and directories on the mounted file system, so that you can work with this filesystem (till it's mounted) without being root.

Re: Creating Loopback Device

Posted: Tue Jul 02, 2013 1:30 pm
by BMW
iansjack wrote:Using root when you don't need to is dangerous ; doubly so if that use is to run a file browser. Far better, IMO, to just change the permissions on the root directory. This is pretty basicc Unix stuff.
If I try change permissions it says "operation not permitted"

Re: Creating Loopback Device

Posted: Tue Jul 02, 2013 2:16 pm
by iansjack
I'd advise you to get a book about Linux and learn the basics. It will make life much easier. This is not really the place to teach you how to change file permissions.

Re: Creating Loopback Device

Posted: Tue Jul 02, 2013 9:58 pm
by BMW
iansjack wrote:I'd advise you to get a book about Linux and learn the basics. It will make life much easier. This is not really the place to teach you how to change file permissions.
I know how to change permissions.

What exactly do I change the permissions on? I tried changing the permissions on the directory to which the loopback device was mounted... is this right? Because it still gets this result after doing "sudo chmod a+rwx OSDrive":
Image
(when trying to copy file to loop device)

EDIT: Also I think the wiki article may be wrong.
Wikipedia wrote: Sometimes, the loop device is erroneously referred to as 'loopback' device, but this term is reserved for a networking device in the Linux kernel (cf. loopback). The concept of the 'loop' device is distinct from that of 'loopback', although similar in name.
EDIT#2: Ok, I have fixed this. What I did was put this in fstab: (then I can just use "mount OSDrive" to mount it and it gives me ownership)

Code: Select all

/dev/loop0 /home/username/Programming/OS/OSDrive msdos noauto,user 0 0