[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: A loop mounted FAT filesystem.



On 19/06/13 17:46, peasthope@shaw.ca wrote:
*	From: Klaus <klaus.doering999@gmail.com>
*	Date: Tue, 04 Jun 2013 08:48:22 +0100
I didn't understand why you used the -"C" option in
this case instead of just giving the device name ?

My objective is to have a FAT filesystem residing in an ext3
file in wheezy.

Consequent to the difficulty with "mkdosfs -C ..." I've tried
working through a case similar to "Floppy Disk Images With FAT16".
http://wiki.osdev.org/Loopback_Device#Floppy_Disk_Images_With_FAT16

# 1. Make the empty image file.
peter@dalton:~$ dd if=/dev/zero of=FATholder bs=512 count=288000
288000+0 records in
288000+0 records out
147456000 bytes (147 MB) copied, 4.55382 s, 32.4 MB/s

# 2. Set it up for mounting.
root@dalton:/home/peter# losetup /dev/loop0 FATholder

# 3. Create the FAT filesystem.
root@dalton:/home/peter# mkfs.vfat
mkfs.vfat 3.0.13 (30 Jun 2012)
Loop device does not match a floppy size, using default hd params

# 4. Show that the user is allowed to mount the image;
root@dalton:/home/peter# grep loop /etc/fstab
/dev/loop0  /home/peter/FATmount  vfat  defaults,noauto,user  0       0

# ... and mount it.
peter@dalton:~$ mount /dev/loop0
peter@dalton:~$ mount | grep loop
/dev/loop0 on /home/peter/FATmount type vfat (rw,nosuid,nodev,noexec,relatime,ui
d=1000,gid=1000,fmask=0022,dmask=0022,codepage=cp437,iocharset=utf8,shortname=mi
xed,errors=remount-ro,user=peter)

# 5. Confirm that the virtual FatFS can be written to.
peter@dalton:~/Work$ cp rawrite.exe ~/FATmount
peter@dalton:~/Work$ ls -l ~/FATmount/raw*
-rwxr-xr-x 1 peter peter 12702 Jun 19 09:37 /home/peter/FATmount/rawrite.exe

Conclusion: success in five steps is better than failure in one step.

Thanks for the feedback,        ... Peter E.


$ sudo mkdosfs -C test-mkdosfs-file 1440
mkdosfs 3.0.16 (01 Mar 2013)

$ ll test*
-rw-r--r-- 1 root root 1474560 Jun 19 20:52 test-mkdosfs-file

$ mkdir mnt

$ sudo mount -o loop -t vfat test-mkdosfs-file mnt/

$ ll mnt
total 0

$ sudo cp mini_ITX_spec_V1_1.pdf mnt/

$ ll mnt
total 379
-rwxr-xr-x 1 root root 387424 Jun 19 20:54 mini_ITX_spec_V1_1.pdf

$ mount
(...)
/home/klaus/tmp/test-mkdosfs-file on /home/klaus/tmp/mnt type vfat (rw,relatime,fmask=0022,dmask=0022,codepage=437,iocharset=utf8,shortname=mixed,errors=remount-ro)

$ df
Filesystem     1K-blocks     Used Available Use% Mounted on
(...)
/dev/loop0          1424      379      1045  27% /home/klaus/tmp/mnt


Did you ever find out why this didn't (doesn't?) work for you?
--
Klaus


Reply to: