What are the pros and cons of installing and running Ubuntu from a microSD card? [closed]
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
I have a laptop with a spare microSD card. I am planning to install Ubuntu 16.04 on that card and use it alongside Windows. What are the pros and cons of running Ubuntu from a SD card? I don’t think there are any pros apart from not having to disturb the Windows partitions. I assume lower read and write speed is one drawback. How slow would it be in layman terms? And what are the other drawbacks. Any recommendations on the card will also be appreciated.
To put it in to perspective, a class 6 SD Card will get speeds of about 10MB/s. A mechanical hard drive should get around 200MB/s. In essence, an SD Card will be so slow, you’re probably going to end up throwing it out of the window.
The only benefit is that you don’t need extra cable and box, just an SD. But an external SATA SSD with UASP box will be far more better.
7 Answers 7
I think the limit is the card reader and not the card.
But how about you install a persistent system an that card. This way it’s like a live system and more parts are loaded into memory. The boot takes longer but should be faster in use.
Writing to the card won’t be very fast. But I think that’s an option to try.
- Please check first, that your computer can boot from the card reader
- This link may help you install Ubuntu into your microSD card (an installed system like installed into an internal drive).
- A good alternative might be to create a persistent live drive with mkusb
- If problems to read or write later on, try according to this link.
Please notice that an SD card
- is much slower
- is much more sensitive to wear of the memory cells and corruption of the logical system to distribute the wear
than an SSD connected via eSATA or USB 3 or a high-end USB 3 pendrive. See this link and links from it.
In addition to the potential speed problems that already have good answers here, there is another issue that you may want to consider.
I assume you are talking about a built-in SD card slot, as is common in newer laptops. You need to make sure that this is a bootable device, and that it will play nice with your bootloader (GRUB or whatever). Some laptops have a BIOS option similar to «Enable Secure Digital (SD) Card Boot», which allows this. But others (for instance my Dell Precision) actively forbids access to the SD card slot during boot, as it’s connected to the PCI-E bus, and not allowed to load the drivers that it would need to use it during boot.
It’s worth noting that some people have had success using chained bootloaders in order to inject the drivers into the boot process, you may want to look over Ubuntu’s official «boot from SD» page here.
Additionally, «boot managers» are also a potential solution for this, for instance the badly-named Plop Boot Manager.
- Small
- Easy to (re)image using windisk32, dd or Etcher
- Various storage sizes to choose from
- Various speed classes to choose from
- Portable
- Everyone is doing it (Raspberry Pi, etc)
- Faster Speed class equates to more money
- Seating, sometimes hard to get in/out of sd card slot in a laptop
- Sdcard slot access could be slower than say a USB3 sd card reader
- BIOS may want USB card reader vs installed SD Card Reader
- Virtual Machines have a hard time reading from an SD Card reader and prefer a USB SD Card reader at times. See this long post on issues: https://superuser.com/questions/373463/how-to-access-an-sd-card-from-a-virtual-machine
- Need OS to be sd card aware to avoid wear leveling issues. Look at these file system alternatives to help maximize your experience.
Lastly, I like the Sandisk Pro sd card family for my Linux distros.
You will ruin the SD Card in the long run.
SSDs (and similar Storage which includes SD Cards) degrades by each write cycle. If you have a Live ISO, that won’t be a problem (but that’s probably not what you want & only if you have no swap partition). With a normal Ubuntu however, the write load will be far above what SD Cards are made for, thereby degrading the card a lot faster than it usually would (we’re still talking about years or so, it’s not like the card will burn the second you boot it)
«a system that resets with every restart» — you mean a regular live ISO? FYI, if you have the ram to copy everything toram , then your read & write speeds (in ram) could be measured in GB/second
@wjandrea yes, but there’s a difference between an SSD and an SD Card. And that difference mostly shows in their lifespan. Because the cards weren’t made for the constant writing that internal Hard drves experience
In addition to slowness, the Linux drivers for SD cards are notoriously buggy and produce data corruption from time to time. This affects even laptops with «eMMC» SSDs (essentially, a high-speed SD card soldered onto the motherboard). I have one of these and every week or so the kernel reports a spurious error due to the card not finishing an operation within an arbitrary 1-second allowance the kernel gives it, and forcibly switches the drive to read-only, requiring a reboot. Sometimes this also leaves corruption that requires a fsck, and (thankfully rarely) actual data loss.
You don’t want to run from an actual slow SD card along with these problems. A good alternative would be a low-profile USB 3 flash drive that fits mostly inside the USB port. These are available in huge sizes now, at least 128 GB and probably 256-512 GB.
«In addition to slowness, the Linux drivers for SD cards are notoriously buggy» — Do you have a reference for that? I believe you if you say you’re having troubles, but that doesn’t mean it’s universal. I don’t recall ever experiencing those problems (and I have a laptop with eMMC storage). Also note that Raspberry Pi’s are essentially Linux PCs with an SD card as the only storage.
@marcelm: I diagnosed (leading to a fix upstream) a longstanding bug in the Linux SPI subsystem that was causing significant corruption on SD cards a couple years ago. The issue ended up being essentially no locking around certain critical sections due to undocumented and misused protocol for ownership of a certain lock. And RPis( which you mention) are notorious for SD card corruption still. The specific problem I’m still experiencing frequently on my laptop might be specific to my particular hardware, but these subsystems being incredibly buggy is an ongoing pattern.
I’m a Xubuntu user (formerly Ubuntu) who has been running its OS on a 16 GB microSD card for about one and a half year, so I’ll relate my experience.
Speed
The general experience is indeed slower than having the OS on a HDD, but not that slow. While I don’t recommend it if you need top performance, I’d say the difference is negligible for the average use (web browsing, music, videos, office suite, basic multimedia edition). In fact, I switched from Ubuntu to Xubuntu to make the most of the limited hardware (XFCE is faster than Unity and GNOME).
Reliability
In all this time the only reliability issue I have faced is when I accidentally move the microSD card and I/O errors show up. It frequently happened to me until I get used to have a microSD card near of my hand when typing, but it still ocassionally happens for external factors. The filesystem gets corrupted and I’m unable to boot normally as fsck needs to be run manually, but such command has never failed me so I can use the system again in a couple of minutes. The worst part is to lose unsaved work, but it is not a big issue if you are used to constantly save the important things (and Firefox is really good when it comes to restore my tabs :’D). Please note that this issue may damage the card in the long term.
Storing
16 GB of storage capacity. The installation process left me with about 5-7 free GB. I only need a few more programs of what comes by default and I store most of my files on the cloud and external devices, so this free space is enough for my needs (but it may not be the same for you).
Conclusion
Install the OS on a HDD/SSD if you have the possibility or if you actually need top performance. Otherwise, installing it on a microSD card is a good choice.
Semant1ka / deploy_linux_sd.md
In order to boot from sdcard card you will need three ingredients: u-boot, linux image with dtb for your device, and linux file system. This article will not cover how to obtain parts mentioned above, I just focus on a brief howto about deploying linux on SD card.
If you just want to update existing u-boot you should skip this step. If you are preparing a card which has some data and partitioning on it you’d better save the image of the card and then clean this card before writing u-boot with commands below.
# this command can take time if you sd card is large sudo dd if=/dev/ of=/sd_card_backup.img # this command will delete partition table sudo dd if=/dev/zero of=/dev/ bs=1M count=1
Copy u-boot image to the card
sudo dd if=u-boot.imx of=/dev/ bs=1k seek=1
Insert card into device, you should be able to see u-boot output in tty console with u-boot version and discription of your device. U-boot will give you an error about absence of partition table.
Before deploying the image we need to create filesystem on SD card. We need two partitions: first patition for the image should be formatted to vfat and second partition for the file system should be formatted to ext4.
sudo fdisk /dev/ Welcome to fdisk (util-linux 2.25.2). Changes will remain in memory only, until you decide to write them. Be careful before using the write command. Device does not contain a recognized partition table. Created a new DOS disklabel with disk identifier 0xc401ca5b. Command (m for help): n Partition type p primary (0 primary, 0 extended, 4 free) e extended (container for logical partitions) Select (default p): Using default response p. Partition number (1–4, default 1): First sector (2048–31116287, default 2048): +100M Value out of range. First sector (2048–31116287, default 2048): Last sector, +sectors or +size (2048–31116287, default 31116287): +100M Created a new partition 1 of type ‘Linux’ and of size 100 MiB. Command (m for help): t Selected partition 1 Hex code (type L to list all codes): c If you have created or modified any DOS 6.x partitions, please see the fdisk documentation for additional information. Changed type of partition ‘Linux’ to ‘W95 FAT32 (LBA)’. Command (m for help): n Partition type p primary (1 primary, 0 extended, 3 free) e extended (container for logical partitions) Select (default p): Using default response p. Partition number (2–4, default 2): First sector (206848–31116287, default 206848): Last sector, +sectors or +size (206848–31116287, default 31116287): Created a new partition 2 of type ‘Linux’ and of size 14.8 GiB. Command (m for help): t Partition number (1,2, default 2): 2 Hex code (type L to list all codes): 83 Changed type of partition ‘Linux’ to ‘Linux’. Command (m for help): w The partition table has been altered. sudo mkfs.vfat /dev/1 mkfs.fat 3.0.27 (2014-11-12) sudo mkfs.ext4 /dev/2 mke2fs 1.42.12 (29-Aug-2014) Creating filesystem with 3863680 4k blocks and 966656 inodes Filesystem UUID: 6473c15f-094f-4972-b209-33f63a8e9a60 Superblock backups stored on blocks: 32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208 Allocating group tables: done Writing inode tables: done Creating journal (32768 blocks): done Writing superblocks and filesystem accounting information: done
Copy Linux image and dtb files
sudo mount /dev/1 /mnt sudo cp zImage /mnt/ sudo cp -r dtb/* /mnt/ ls /mnt imx6qp-sabreauto.dtb imx6qp-sabreauto-ecspi.dtb imx6qp-sabreauto-flexcan1.dtb imx6qp-sabreauto-gpmi-weim.dtb zImage
If you copy file system image like shown below, your filesystem will be the size of the image and won’t use all partition space.
sudo dd if=fsl-image-gui-imx6qsabresd.ext3 of=/dev/2 bs=1M
If you want to use the whole patition for the file system, cope files manually.
mkdir ~/mnt mkdir ~/mnt/target mkdir ~/mnt/yocto sudo mount /dev/2 ~/mnt/target/ sudo mount -o loop tmp/deploy/images/imx6qpsabreauto/fsl-image-machine-test-imx6qpsabreauto.ext4 ~/mnt/yocto/ sudo cp -a ~/mnt/yocto/* ~/mnt/target sudo umount ~/mnt/target sudo umount ~/mnt/yocto
Now SD card is ready for boot!