Automount USB exFAT drives with Synology NAS - linux

I installed a library for exFAT support and I have to manually mount it via SSH. I would like to get it to operate as it does out of the box with drives that are FAT formatted, where appears as one of its shared folders.
The command I am using is something like this:
/mount.exfat-fuse /dev/sds1 /volume1/homes/admin/exFAT
I am not sure of the mechanics of how the NAS does it automatically with its OS. I figure it might be similar to how other Linux OS's do it.
Background instructions for adding exFAT support are here: https://forum.synology.com/enu/viewtopic.php?t=62473&start=90#p390456

Related

Is it possible (or advisable) to use NixOps to install NixOS to a USB flash drive?

I'd like to install NixOS to a flash drive, and have the operating system run entirely on the flash drive. Is it possible to install to a flash drive using NixOps? Or would I even need to? That is, would it be easier or better just to write a script that would do it?
First let's get this out of the way: if the purpose is just creating a live installer to install NixOS on a system, you should follow the instructions in the NixOS manual.
Assuming you want the drive to be capable of updating itself, you should avoid NixOps. Unlike the nixos-install command, NixOps was not designed to copy only the evaluated and built machine to the target machine. It will not copy the Nix-language expressions over to it, so the target machine will not be able to update or modify itself.
I see two possible approaches for this. The most straightforward one is to use the nixos-install command to install NixOS on the drive like you would install it on an internal drive. To the kernel and every sane BIOS, a USB stick is just another block device to boot from.
The other approach is following the manual and changing the root= parameter, which may make changes persistent. I have never done it for my installation USB sticks, so I don't know whether that really works.

How does embedded linux detect file is modified through usb gadget & update files

I have an embedded linux device running a USB gadget kernel module to make the mmc available to the host PC(such as Windows or Linux).
When I update the file in mmc, it won't sync with host PC unless I rmmod and insmod again. Is there any better way to update new files? And how can I detect a file is modified by host PC? I'm using C programming on my linux device.
Thanks.
(1) There really isn't a better way to update new files. You need to take turns and only access the mmc from Linux or Windows, one at a time.
(2) You can't easily do that.
When you say "When I update the file in mmc", I assume that you have the mmc mounted in the linux device, and are updating files from linux at the same time that Windows has mounted the device. I don't think this is advisable. The host (Windows) may cache file and/or directory information from the mmc, and if the embedded Linux changes that information unexpectedly, it may produce errors from the Windows FS, and could corrupt the mmc.
If you want to share files between the embedded Linux and host Windows, and be able to modify them from either OS without taking turns, an alternative solution would be to use the network device gadget and run Samba file sharing on the embedded Linux side to export the filesystem where the mmc is mounted on the Linux side.

How can we use Linux from a small storage pen drive? Does it work on micro-controllers also?

I generally hear that LINUX OS can be downloaded on flash, pen drive (floppy disk?) etc. How we can do that?
I have RHEL 5.4 source code - so how can download it into pen drive and how much space is required?
What other functionality I can add apart from the OS - so that when I boot from that storage device I can make use of them?
Can we download Linux OS into micro-controllers also?
I generally hear that LINUX OS can be downloaded on flash, pen drive (floppy disk?) etc. How > we can do that?
If you can't get it to work on your own, you can buy a ready made Linux on a USB drive from
a site like http://www.osdisc.com or http://www.cheapbytes.com
Not all PCs, especially older PCs, can boot from the USB Drive. Even some newer PCs are beginning to ship with security features that can interfere with booting code. When it does work, you have to find out the proper way to boot the USB drive. You might have only a few seconds during reboot to enter the right key, or it will boot Windows (if Windows is installed). The key to get to the BIOS Boot Menu might be delete or escape or F10 or some other key (varies with PC motherboard manufacturer). A message on the screen that flashes by rather quickly might mention keys you can press. Boot to a specific device or changing boot order can also often be found in the BIOS setup.
There is a linux utility called unetbootin that will create a USB drive that will boot linux. It does not create a USB boot drive from a source code distribution, but rather from an ISO file representing a live CD or the live CD itself.
Since large USB drives (e.g. 32GB) are relatively inexpensive, if you want to compare systems or have multiple systems there is a way to have multiple linux and other operating systems on one USB drive and be able to choose which to boot into. See, for instance, http://www.pendrivelinux.com/ which has a wide variety of procedures for making a bootable USB using either windows or Linux to set up the USB and booting a variety of systems.
I have RHEL 5.4 source code - so how can download it into pen drive
and how much space is required?
RHEL 5.4 is a bit old. You need the Live CD, if there was one.
The ISO file can take up 600+MB. You want space left over to use the system. 2GB for the pen drive is OK. Sometimes you can get by with less.
What other functionality I can add apart from the OS - so that when I
boot from that storage device I can make use of them?
Upon boot the operating system will often recognize sound cards, other usb devices, the hard drives, etc. You need to know how to use these things within Linux, and how to enable them if they are not configured. Some Linux distributions have a place to put packages that are to be autoinstalled when a USB pen drive based system initializes. In this way you can "install" software from the distribution archives that are not included on the standard live system, even if you don't have internet access.
Can we download Linux OS into micro-controllers also?
People run it on raspberry pi and such, but the versions of Linux on non-PC hardware that has low memory are often quite tiny compared to a desktop version. They can be tiny enough to be challenging to work with or expand.

Converting FILES to NTFS

I did something wrong with my dual-OS PC (XP Pro and Ubuntu) and it now only works when booting from an Ubuntu Live CD (8.04 LTS).
I am backing up my data to an external HDD for reinstalling everying. I am not worried about the Linux part of my data because the external HDD is formatted in ext3, the file system Ubuntu operates on.
But what about the Windows part of my data? Does Linux (the live CD) properly copy NTFS files into an ext3 HDD? And then does Linux (this time, the newly installed Linux system on PC) properly copy them back to the NTFS partition?
I know I am asking a very simple question. I am sorry if I appear to ask someone to do my homework but I cannot experiment myself now.
Thanks you all in advance!
Edit:
Is it perhaps better to format the external HDD in fat32?
As amemus said, fat32 would be better for the external HDD. Even though it's Microsoft, fat32 is still, by far, the most supported HDD format.
That said, what you said SHOULD work, given you use a new-ish distro of linux with new packages.
Ubuntu 8.04 is very old these days, but I believe it had good support for NTFS read (using the old ntfs driver). It will correctly copy your Windows files to the ext3 external hard drive, plus or minus some attributes/permissions which have no equivalent in ext3.
Newer Ubuntu releases have full NTFS read/write support via the ntfs-3g driver which I have found to work very well.
Sidenote: I have found NTFS is a reasonably good filesystem for external hard drives - it works well for Windows and recent Linux computers, and it's technically superior to FAT32. The only issue is if you have to interact with Apple OSX, which still doesn't understand NTFS. (You can make OSX understand NTFS with a liberal application of FUSE and ntfs-3g, but it's not nice.)
Note: This is probably the wrong Stack Exchange - StackOverflow is for programming questions. Maybe the Ubuntu stackexchange would have been better?
Ubuntu shouldn't have a problem reading from NTFS.
Writing to NTFS used to be very difficult, but its gotten a lot better (a simple google search turns up lots of results)
As long as you aren't working with large (~4GB) files, FAT32 will be easier to work with across lots of different platforms.

What is a casper rw loop file and why do I need it to make saving persistent on a USB flash drive?

Suppose I've installed Linux on my flash drive. Why do I need something like the casper loop file to make saving persistent? So files are being erased? Isn't the flash drive the same as actual hard disk drive? I'm a Linux noob so be patient.
Or it is because Linux on a flash drive is actually like live CD on a flash drive? Can it be installed just like it is installed on a hard disk drive?
Live Linux off a USB stick is done by embedding a bootable, read-only filesystem image as a file on a USB stick and booting from that. This is done for a couple of reasons, the largest of which being that the stick remain readable / usable on other systems, but also because it means you can use the same stack of files to make a Live CD as a USB stick.
Normally when this is done, the RW portion is done via a ramdisk, however with a USB stick, you have the opportunity to store the mutable portion of the live system on the stick.
You may think, "well, why not just do it as a directory on the stick?" The reason for this is that a FAT32 filesystem doesn't have all the metadata that a Unix environment needs. You need to use something like ext2.
So what is a casper file? It's a file that has been treated like it's a hard drive partition. That's it. Instead of pointing mkfs.ext2 or mount at /dev/sda3 (a partition), you've pointed it at /mnt/sda3/casper-rw (a file).
Casper is basically a storage container for Linux systems which downloads programs/drivers/settings anything that is software based is saved in. The files that are not in the casper drive are either the live cd (which would be on a USB drive in this case) and user-created files such as Open Office documents, pictures, and videos. Don't use up the free space on your USB drive with casper or you won't have room to save documents on the drive.
You can install Linux onto your flash drive which in turn wouldn't need a casper persistent storage because of how it runs, but it renders the USB drive as only usable on the pc that it was installed with.
That's what casper provides because a live USB drive can be used on many pcs with the same hardware configuration as the version you downloaded, and casper brings your programs and settings with you.
It seems like a "no brainer" model in keeping your "Tool"=(OS) & your "Art"=(Data / Documents) isolated from each other, and it could go even farther by "Tool"=(OS) "Special Tools"=(Additional 'wares) & "Art"=(Data / Documents).

Resources