Mounting Raw Disk Image File in Nautilus - gnome

I'm running Ubuntu 10.10. As part of SD card creation, I have a script that successfully creates a raw disk image file, correctly formatted with an ext2 file system. I have built SD cards from the raw disk image file with dd.
Now, I'd like to mount it and browse the files using Nautilus.
I know I can use mount -o,loop to mount it to a mount point. I would like to get it mounted by gnome to an automatically created /media/xxx mount point. I have used partprobe /dev/loopn to get the file noticed. It appears in my Places menu and if I select it from there, nautilus opens the disk, just fine.
What I would like to do is get my script to kick nautilus so its file browser window opens the image file's root without having to select it from the Places menu.

You could also use gvfs-mount.
List mountable devices
gvfs-mount -li
Mount device file found above from label
gvfs-mount -d /dev/sdaX
Nautilus uses the same underlying library (gvfs)
After that you can use
nautilus /media/LABEL

if you know the path to the directory you can use gnome-open like:
gnome-open /media/xxx

You can use gnome-disk-image-mounter (probably with option --writable) to mount an image using Gnome, which itself will be available by Nautilus.
If you want a graphical application like Nautilus to browse the files, why do you not configure it to mount images by itself?
With 'right-click|Properties|Open With' you can just use gnome-disk-image-mounter to do the task you want, including opening the folder.
See my answer to another question to open the image writeable.

Related

Reading from text a file in a USB device.(C++/Python3)

`
texttobecopied = open('mtp://%5Busb%3A001,015%5D/Internal%20stora/AppInventor/data/Scan_result.txt', 'r').readlines()
//opening the text file which I want to read. This is located in the USB tethered smartphone. The mtp://.... part is the path for that file.
appendFile = open('destinationFile.txt', 'a')
//opened the destination file into which I want to write.
appendfile.write('\n')
appendFile.write(texttobecopied)
//tried to write that text from source file into my destination file .
appendFile.close()
Beginner here.
I need a program that reads text from a .txt file located in my USB tethered phone(Internal storage) and writes that text in a file on my system.
I tried the conventional way by specifying the path (the traditional object.open('path/name'.'r') way) but it didn't work.
Is there a way I can do that? I do not wish to copy the file containing the text, I just need the text inside.
It's the Gnome virtual file system daemon (gvfsd) that works behind your back...
First, the phone's file system has to be mounted somewhere, it's not in the usual places (/mnt/, /media/) but it'd be registered in /etc/mtab, shouldn't it?
In my case it's at the end, and it's mounted in a runtime directory named against my UID,
$ grep "/$UID/" /etc/mtab
gvfsd-fuse /run/user/1000/gvfs fuse.gvfsd-fuse rw,nosuid,nodev,relatime,user_id=1000,group_id=1000 0 0
At this point I know the mount point in the computer file system of the phone file system and I can list its content
$ ls /run/user/1000/gvfs
'mtp:host=%5Busb%3A001%2C006%5D'/
I know the contents of my phone so that I can open, using Python, one of the files on my device
$ python -c "open('/run/user/1000/gvfs/mtp:host=%5Busb%3A001%2C006%5D/Internal shared storage/Ringtones/08_River.mp3', 'rb')"
$
As you can see, no errors opening the file.
I hope that you can adapt this recipe to your specific situation and accept my answer.

usb data reverted upon removal in Linux

I am trying to change a file in the vfat partition on a card with raspbian on it.
The boot partition is vfat.
After mounting it I tried changing a file on it with vim, nano and gedit (in the GUI), even overwritten it with cp, but if I remove and reinsert the card reader in the computer, the changes are reverted.
I also tried using the sync command after editing with no avail. And I was using root in all cases.
Could anybody please tell me how to permanently edit the files on the card?

Rsync copies unchanged files (USB Drive, FAT32)

I use rsync to make backups of my files located on my NAS to an USB device. I use the following command:
sudo rsync -rv --modify-window=9999 --update --delete --stats --progress --log-file=/shares/Franck/log/backup_photos.log /shares/Public/photos /USB_DRIVE/photos
Everything works fine provided that the USB drive remains attached to the NAS. That is to say, rsync copies new and changed file and nothing more.
However, from time to time I use the backup USB drive for other things and plug it to other windows and Mac machines (but I do not touch the /photo folder on the drive) and when I mount it again on the NAS and lauch a backup, rsync copies every single file again (even if it hasn't changed).
Do you know how to fix this? Thanks.
The drive is formatted in FAT32 format and that cannot be changed (I interact with Linux, Windows and Mac). I know this is not optimal for rsync but I have to deal with it (I do not care about keeping permissions informations and so on).
I've been trying to figure out the answer to this for a long time, with no success. But I've just stumbled across the answer. It's a FAT32 short-filename issue; apparently, by default, Linux converts them to all lower case, which messes up rsync's ability to see that it's the same file on the source & destination.
The solution is to mount the FAT32 device with the 'shortname=mixed' option. I believe you also need to use utf8 charset, e.g. 'iocharset=utf8'. Then run rsync with params: -rtv --modify-window=1
On Debian with Trinity, I can right-click the FAT32 partition's icon on the desktop, Properties / Mounting, set Short Names to mixed, and make sure UTF-8 Charset is checked. Hopefully there's a way to make those the defaults for all FAT32 partitions, but I haven't looked for that yet.

How can i modify isolinux.cfg?

I used SARDU for multi-bootable live DVD. first I made live usb which made perfectly in which I can modified. then i try to made dvd in which i can't modify isolinx.cfg but in usb i can modify syslinux.cfg. How can i modify isolinux.cfg then how to boot cd?
A DVD is a write-once media. When the file isolinux.cfg has been "burned" to the DVD disk, there is no way to change it (well, you could scratch it away with a tiny pin ...)
You could use an overlay filesystem but that won't help because the boot loader doesn't support it (the file system needs the kernel, so the boot loader would need to start the kernel first to read its own config file).
[EDIT] One solution is to create copy the files from the DVD somewhere, make the changes and create a new DVD image (iso file) from that.
Next, make sure that the changes made it into the image (mount -o loop file.iso /mnt and then look at the files under /mnt. Don't forget to replace file.iso with the correct name of the ISO/DVD image file on your hard disk!!)
If that is OK, create a bootable USB stick with the DVD image. This way, you can test that the image actually boots without wasting DVDs.
When everything works, burn a DVD.

Mounting with bindfs without nautilus noticing

I want to user-mount a directory to some other directory without the need for superuser rights. I found the fuse tool bindfs does exactly that BUT nautilus will show every mount in its sidebar. The tool I'm writing will mount a lot of different directories dynamically so it would be a bit annoying to see all those mounts in the file manager changing all the time.
Is there something I can do about that? Or is there a better tool than bindfs?
Thank you.
This is a small workaround..
You could press the small triangle next to the "Devices" button in the side bar..This collapses the Devices tree.

Resources