Creating Loopback Device

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
User avatar
BMW
Member
Member
Posts: 286
Joined: Mon Nov 05, 2012 8:31 pm
Location: New Zealand

Creating Loopback Device

Post 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?
Currently developing Lithium OS (LiOS).

Recursive paging saves lives.
"I want to change the world, but they won't give me the source code."
User avatar
escortkeel
Posts: 9
Joined: Mon Jan 28, 2013 4:46 am
Location: Canberra, Australia
Contact:

Re: Creating Loopback Device

Post by escortkeel »

You are going to want to give your file browser root permissions. Perhaps try invoking it at the terminal, prefixed with "sudo".
I'm Keeley Hoek. | Homepage | K-OS on GitHub
User avatar
iansjack
Member
Member
Posts: 4711
Joined: Sat Mar 31, 2012 3:07 am
Location: Chichester, UK

Re: Creating Loopback Device

Post 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.
Nable
Member
Member
Posts: 453
Joined: Tue Nov 08, 2011 11:35 am

Re: Creating Loopback Device

Post 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.
User avatar
BMW
Member
Member
Posts: 286
Joined: Mon Nov 05, 2012 8:31 pm
Location: New Zealand

Re: Creating Loopback Device

Post 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"
Currently developing Lithium OS (LiOS).

Recursive paging saves lives.
"I want to change the world, but they won't give me the source code."
User avatar
iansjack
Member
Member
Posts: 4711
Joined: Sat Mar 31, 2012 3:07 am
Location: Chichester, UK

Re: Creating Loopback Device

Post 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.
User avatar
BMW
Member
Member
Posts: 286
Joined: Mon Nov 05, 2012 8:31 pm
Location: New Zealand

Re: Creating Loopback Device

Post 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
Currently developing Lithium OS (LiOS).

Recursive paging saves lives.
"I want to change the world, but they won't give me the source code."
Post Reply