Using ZFS with Embedded Linux - linux

I'm running embedded Linux (Debian on ARM/X86_64). Since it is very much like a full OS, with some hardware differential and a different platform, you may consider it as a regular machine. So, this will be used in the robotics field where the computer will ALWAYS be hard reset by turning off power. It would disqualify me to use a UPS so I would need to make the system infallible.
I'm running some processor-intensive tasks, like OpenCV and OpenNI and OpenKinect. How do I use an uber-powerful filesystem, like ZFS to mirror the entire disk on the SSD for error correction? Does ZFS perform well in Linux? I'm still kinda a newbie in Linux so I don't understand it's internal workings.
My list of possible platforms are:
--Debian#RaspberryPi
--kUbuntu#ODROID-X2
--Ubuntu#PandaBoard
--Ubuntu#NUC-i3/5.
Also, how can I make sure the filesystem doesn't get damaged during reset? I need the computer to start in good time, A.K.A, <3 minutes for the competition.
I will probably be using a 32GB SSD, so I guess a 16GB partition mirrored 2x works or 12 # 3x. I only need to get an OpenCV install working because the code will be downloaded from a SAMBA NFS automatically!
Thanks for your help and good luck ;)!

ZFS is not suited for low memory systems. It do perform well on system with 4GB of RAM and more.

Related

Linux Driver Development - Can I seriously harm my system?

I am currently reading a book about driver development for Linux.
Now I started writing a driver for the razer naga mouse.
My question is, what is the worst case scenario in driver development?
(I am not touching any CPU, Hard disk, Ram etc.)
I always thought the worst thing that could happen is that I crash the system and have to reboot it then. Before I continue writing code, I would like to make sure I can't seriously harm my system.
Hardware nowadays is pretty redundant. It is very hard to break hardware using software(heating issues aside).
Worst case scenario is you brick your system and might have to reinstall the OS. This can happen pretty easily during device driver development. You have file system drivers in the kernel and your drivers might corrupt the kernel stack which might leave it in an unusable state.
The linux kernel has pretty good safety measures built in, like dropping to read only mode once the kernel is corrupted. This mounts your root file system in read only mode so that you cannot trash it.
So, always be on the safe side. Try to develop in a VM like Virtualbox which gives you pretty much everything nowadays.

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.

Programming to different installation types of Ubuntu

I'm studying for a CS degree, and I need to install Ubuntu for a computer systems class. We are going to do low level Assembly optimizations and stuff like that, so they don't want us to install it in a VMware.
Now, I don't want to do a regular dual-boot install, because I've already done it on my previous computer a couple of years ago, and wrecked my hard-disc with the partitioning. Wikipedia says you can use Wubi to boot Ubuntu from ISO, or install it to a flash drive and boot it from there, and then thus remove the need for partitioning.
Now, my question is - how different it is to program for Ubuntu booted from a regular hard-disc partition, from a Wubi ISO, and from an SD card? I guess the programs will work the same on all options, but we're going to do play with low level Assembly optimizations - can I expect to face any difference in that department?
I'm not sure I'd go this route if it were me personally.
You should be fine in terms of whatever bare metal type stuff you want to do -- you're working with memory, the cache, the chip, etc, so your disk drive shouldn't matter (unless you're doing stuff to the filesystem or something).
Where I think you might get annoyed is the logistics of setting up your development environment. Everytime you boot from your USB stick, you're going to need to sudo apt-get GCC, scite, et. al, load your files on into directories that you want, and then get started. That's a hassle. You could optimize this somewhat by creating a custom ISO of your environment using some kind of tool (you might be able to do it with Clonezilla), but still.. yuck.
I would suggest (speaking of Clonezilla) that you snapshot your hard drive, go ahead and install dual booting with Ubuntu, and then you have a backup if anything goes wrong. Or, I'd think you could get by using the school's machines. Don't they have any Linux boxes that you can ssh into, if not use in labs?
Anyway, good luck. :)

building linux kernels

i Just got the book Linux Kernel Development by Robert Love . It has lots of places where you are required to modify and build the kernel . So how should i go with it . Is it better to use a VM , or should i somehow get a proper test machine for it , since i dont want to goof up on my system and data.
A VM has the advantage of offering snapshots. These allow you to save the state of the machine - if the kernel build doesn't work you simply restore the snapshot, and you are able to take as many snapshots as you have disk space to store them. You are also able to clone and re-deploy the VM image, so you have many identical systems to test on.
The same experiment on a physical machine would require far greater effort (ghosting/cloning the disk, re-installing the OS etc).
VirtualBox is free, cross-platform virtualisation software.
There are a lot of tutorials on the web about this topic, e.g. here:
http://www.digitalhermit.com/linux/Kernel-Build-HOWTO.html
http://www.kernel.org/pub/linux/kernel/people/gregkh/lkn/lkn_pdf/ch04.pdf
You could do either or both. An alternative somewhere in between is to setup a dual boot. This is a little riskier than a VM, but not too much.
coLinux
or run linux iso image using QEMU on windows

Best/Easy way to set up a quick booting Linux

Hopefully this still falls within StackOverflow's umbrella!
I'm looking to create a quick boot linux laptop for my wife. All it really needs is to be able to do is browse the internet (with flash and video etc.).
Are there any distros that are made for this, or any guides out there that show good ways to speed stuff up? I've read that I should "remove stuff from the kernel that I don't use" but that's a little out of my skill set.
Thanks!
If you're using Ubuntu (or a variant, like xubuntu or kubuntu), there is a package called BootUp-Manager. There's an article about it over at Lifehacker. It lets you check and uncheck things in the startup and shutdown scripts to optimize things (such as turning off checking for new hardware, or whatever)
You may also be able to gain a simple speed-up by going into System->Administration->Services and disabling any services you don't need.
If you'd like to see how much time is being spent on each part, install the package Bootchart, and that should give you a detailed profile of everything that goes on during startup, and let you focus on the most time-consuming parts, and measure your progress as you tune the system.
I believe Xubuntu is designed for low memory footprint/fast booting and whatnot while still having a decent amount of features. Not a Linux user but it just seems to stick out in my head.
Some guys got an EEE PC netbook booting in 5 seconds running a modified version of Fedora. Might be a good starting point: http://lwn.net/Articles/299483/
Try: Damn Small Linux is a very versatile 50MB mini desktop oriented Linux distribution.
Alternatively, get an Asus motherboard with expressgate - it has an onboard Linux (spashtop) that boots in 3 seconds. Its designed for quick web surfing, IM, music etc whilst still letting you boot into your main OS.
If you really want it to boot fast, I would suggest creating an initrd containing exactly the software you need to do what you want it to do. The initrd will get read from the disk once as one large file, and then everything will run out of ram.
This is not an easy solution, the easiest solution will be jishi's solution of using a Live CD, but, that won't be the fastest solution.
I have been using Kubuntu 14.04.4/5 on a Dell laptop with dual boot. Am not real happy at the moment with it. You are all correct about the slowness of a liveCD.
There are LiveCD-versions of working linux-distros with browser and installed flash, java.
Check out LiveCD
http://en.wikipedia.org/wiki/Live_CD
you will find links to different flavours with download.
There are also USB-drive-versions.

Resources