New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Mounting (network)drives ext2/3/4 so they show up in chromeos Files App #954
Comments
This could be much smaller, I seem to remember 720k floppy disks (not sure what is the actual minimum).
The label can be added there with
Does the trick still work if we mount it as Could we auto-mount ext2/3/4 USB drives with an udev rule? (I'm pretty sure we can actually, the tricky part would be to get the eject button to work properly: currently it only removes the bind mount) |
Is it possible to |
@drinkcat Without running into issues smallest was 1024 Kb. With a quick google I couldn't find a real defined minimum for the size. So I for now took just a shortcut and tried some sizes. I will see if I get some more info on that. Yes we can use "ro" no problem, that will work. I adjusted the topic post with the changes. @dnschneid Yes that is possible, but crosdisk won't like that. It will still show as mounted in the Files app. However if something is mounted on top of the fat32 bindmount you can't unmount it in the Files app or on the command line. |
The idea with my comment was to unmount the fake loopback partition leaving the bindmount in place, so that when Files does eventually unmount it, it will get rid of the bind-mount and remove the directory. |
@dnschneid Ok this needs some attention, I don't think it will be that easy, however I didn't really looked into it yet.
I left out ACTION to see if the rule works. On removal of the drive it works, but when a drive is added not. It seems like crosdisks is blocking further execution of rules when coming across an ext2/3/4 partition. I didn't look at the source code yet to confirm this. If I make it to watch when a drive got added it is processed.
Get the drive info from a specific drive:
If someone has another idea or howto get a udev rule to work for a partition that gets executed... |
Removing the ID_FS_TYPE check from the udev rule does the trick Thanks drinkcat ;)
The file system type check must be done in the script file. When pressing the eject button in the Files app the ext4 partition gets unmounted. Only to clean up we need to unmount the loop device with |
Created some scripts to test mounting/unmounting ext2/3/4 usb drive and sd cards. mount-extfs will setup the udev rule with the following command
unmount-loop will take care of the loop unmounts. With these scripts I did some testing when suspending and waking up. When I unmount the drive before suspending it gets nicely mounted again on wakeup. If I let it suspend without unmounting first it will be still mounted when waking up. It behaves well so far. Just need to format a usb drive with some multiple mixed filesystem partitions on it. Only the SD-card I tested with had a mixed partition with vfat and ext4 mounting worked well as expected. Something else to think about. What permissions should we use to mount the drives. I guess by default noexec . BTW we could add some mount options string when we call the script to allow people to create there own udev rule for example when they want the drive mounted as exec. Edit: Pushed the scripts to my git repo changed the formatting so it is better readable also added default mount options. |
A little update, mounting a usb stick with 4 partitions and a SD card with 2 works now with the script. |
How about a lockfile? |
@dnschneid That could maybe be an option, however I am still afraid of timing issues. If someone wants to test or has some feedback on the code: |
I am not a shell master (instead JAPH) but tried to figure this out briefly What I did instead was completely redo my chroot on the internal SSD, and The specific code I'm talking about is in the enter-chroot script, and I Bind-mount ~/Downloads if we're logged in as a userlocaldownloads='/home/chronos/user/Downloads' IMO this is something that definitely needs to be addressed, besides Namaste- -SS NUNQUAM NON PARATUS ☤ INCITATUS ÆTERNUS ヽ(´◇`)ノ V/T: 00.1.408.718.6290 Skype: Scott Solmonson On Tue, Aug 19, 2014 at 9:17 AM, divx118 notifications@github.com wrote:
|
I was about to update the scripts to match the unwritten rules for crouton scripts. Any ideas are welcome. |
Sorry to potentially turn things on its head, but here's a thought: As far as crouton is concerned, it doesn't need to be able to automount ext media. All it needs is the ability to launch a chroot via scripts only on the removable media, with the chroot stored on removable media in a filesystem that is Linux-safe, without touching the device's internal storage. After that, you can set up auto-mounting of ext filesystems for other purposes, but it can be independent from crouton. Here's what I'm thinking: for external, non-ext media, we create a new type of chroot mount: an expanding image. I think everything can be implemented in mount-chroot/unmount-chroot. Use 2 GB chunks and this technique to create a multi-part loop mount with ext4 on it. Run a monitor script that waits for there to be less than 1 GB free, then allocates and adds a new chunk to the dm table and live-grows the ext mount. Add a parameter to unmount-chroot that runs a compaction on the chroot if there's >3GB free space. This fixes a few problems:
Your thoughts? |
@dnschneid Yes, always wondered why crouton didn't use image files especially with the problems you get on fat32/ntfs. |
One possible option is to use sparse files, and create a large FS (same size as the USB stick), that takes no space on the actual physical device Another thought. Has anybody tried to create an encrypted chroot on FAT32? |
Yeah, it needs to work on all external filesystems. Does ecryptfs encode UNIX permissions in the file? That could indeed be an extremely good solution (even if we make it so that an "unencrypted" chroot uses a null encryption key), assuming the filename encryption doesn't result in names that are too long for fat32. |
what about creating a wubi style root.disk on an ntfs formatted usb device and mounting there? advantages are that it is a single file, supports linux permissions, and even the creation of partitions within the image file, and can be file encrypted, or full device encrypted, supports journaling. disadvantages are it can't easily be resized, probably won't support any hibernation (a good thing, IMHO), not sure if chromebooks or macs can reformat usb devices to ntfs easily. FAT32/vfat might work, but then 4gb limits for / , /home , etc. |
ecryptfs does not work unfortunately, permissions and symlinks rely on the underlying FS... qcow images are designed for this, but that'd need some fuse driver, so, probably not great... |
Oh well, sounds like ecryptfs is out. @tedm thanks, but the approach I suggested has none of those downsides. And whatever we do, we want to keep it as similar to what happens normally (i.e., no partitions to deal with) to avoid unnecessary complexity interacting with the rest of crouton. |
@divx118 I have both a usb external hard drive and SD card with ext4 partitions. The SD card has my chroots. I'm having trouble getting the mount-extfs script to mount either of them. I can't figure out why it's not working. It seems that the dbus-send line isn't mounting. I'm on ChromeOS Beta. If there's anything else I can try, please let me know. Here's the content of the log file for the external drive (sdb):
|
Yes, you are probably right. It seems the file app doesn't wan't to mount the loop device. I had this before sometimes when I created a udev rule that triggers on partitions, but since I switched to scan the partitions in the script it just works. |
I have an Acer C710-2833 (PARROT SICKLEBILL A-D 1328) with 10GB of RAM. I Here's what happens when I monitor dbus-send: chronos@localhost / $ sudo dbus-monitor --system --monitor I then get the "Sorry, your external device is not supported at this Thanks, On Wed, Sep 10, 2014 at 11:46 AM, Maurice van Kruchten <
|
@mfbenson
Create a mount dir:
Mount the device on the directory just created. Probably /dev/sdb1 in your case:
Now your device is mounted, but won't show up in the Files app. However you can use it for starting your chroots. The mount command above will mount with default options, so you also will have exec rights.
I see if I can reproduce your problems with the script. |
Thanks for the steps. I was able to get those to work manually, so I'll use Thanks, On Thu, Sep 11, 2014 at 11:35 AM, Maurice van Kruchten <
|
@dnschneid I played around a bit with dmsetup. Although it works, the following drawbacks make it hard to use. |
Totally agree. There should be one solution for removable media that works automagically, regardless of filesystem. |
I did some test with mount.posixovl on a usb drive with a fat partition. It works but too slow. I almost setup a working chroot, but lost patience when it was running for a few hours. Using the binary from the package fuse-posixovl on trusty works on chromeos. |
Thanks for trying that out. It also looks like posixovl doesn't help with case insensitivity, so it's a bit limited as insulation from the card filesystem. |
FYI, I'm using the dmsetup thing on a FAT32 USB stick: https://gist.github.com/drinkcat/8209d412a25a1a0f79f6 . It does not work awesomely well as the USB stick gets unmounted on suspend (no persist: crouton needs to be smarter about the flag...) |
@dnschneid Yes you are right, I overlooked the case insensitive. |
FYI, ext4 is coming back: https://code.google.com/p/chromium/issues/detail?id=315401#c124 |
This was fun, but not necessary anymore, now that ext4 support is back in Chromium OS. |
wow |
I looked at the source of crosdisks and did some experimenting with dbus-send to mount a drive that will show up in the Files app.
First thanks to drinkcat for coming up with the idea of a loop device and testing it :)
Create a small fat32 loop device:
Now we can mount the loop device with the following dbus-send command.
Note:
To monitor the dbus you can use the following:
Why:
Support for ext2/3/4 will be dropped in the chromeos files app this is already active in dev channel see https://code.google.com/p/chromium/issues/detail?id=315401
Now we can use the small fat32 partition device to bindmount shared directory, ext2/3/4 formatted usb drives, network drives.
This would also solve #620 for a part.
Please feel free to discuss on how the approach should be to get this as a nice enhancement.
The text was updated successfully, but these errors were encountered: