Differences
This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision | ||
| docs:guide-user:installation:installation_methods:sd_card [2019/09/14 09:06] – ↷ Page moved from inbox:docs:installation:sd_card to docs:guide-user:installation:installation_methods:sd_card tmomas | docs:guide-user:installation:installation_methods:sd_card [2024/12/13 16:42] (current) – [Expanding the filesystem] fix link for correct location palebloodsky | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| ====== SD card ====== | ====== SD card ====== | ||
| - | Installation | + | OpenWrt |
| - | FIXME //Provide an outline of the procedure here// | + | ==== Graphical Utilities ==== |
| - | ===== Prebuilt disk images ===== | + | Install [[https:// |
| + | - Download the image for your device which will be named similar to '' | ||
| + | - Select the image | ||
| + | - Select your SD card | ||
| + | - Flash the image | ||
| - | Examples: | + | ==== Command Line ==== |
| - | * [[toh: | + | |
| - | | + | |
| - | | + | |
| + | | ||
| + | | ||
| - | Which image to chose, ext4 or squashfs, or...? | + | ==== Which image to chose? ==== |
| + | Most SD card devices have multiple images available which differ in the [[: | ||
| - | * ext4-sdcard.img.gz | + | === ext4-sdcard.img.gz |
| - | * squashfs-sdcard.img.gz | + | * Not optimized for flash memory (journaling increases flash wear) |
| + | * SD card can be easily mounted externally for modification | ||
| + | * Updates and changes can be made directly to the partition | ||
| + | * Linux desktop standard | ||
| + | |||
| + | === squashfs-sdcard.img.gz | ||
| + | * Compressed | ||
| + | * Newer images include a hidden F2FS filesystem, which is optimized for flash memory | ||
| + | * Needs special mount procedure to externally modify | ||
| + | * All changes are done in an overlay partition | ||
| + | * Due to overlay partition it is simple to reset system to defaults | ||
| + | |||
| + | === Other images === | ||
| * ubifs-sdcard.img.gz | * ubifs-sdcard.img.gz | ||
| - | * ... | ||
| - | Howto: | + | ==== Mounting a squashfs image locally ==== |
| - | - ... | + | |
| - | - .... | + | If you insert your newly flashed SD card into a Linux computer it will be easy to mount the read only squashfs partition but it won't know about the overlay, which is not even in the partition table but instead located immediately after the squashfs filesystem in the same partition. In fact, before you've booted the SD card on your device, the overlay won't even exist. |
| + | |||
| + | So, first you need to make sure you've booted your image. You then need to mount the overlay as a loopback device. You can discover the offset by running '' | ||
| + | |||
| + | < | ||
| + | # Setup the loop back device. | ||
| + | # See libfstools/ | ||
| + | DEVICE= ### Set this appropriately | ||
| + | PARTITION=" | ||
| + | FS_SIZE=" | ||
| + | FS_OFFSET=" | ||
| + | LOOP_DEVICE=" | ||
| + | |||
| + | # Now mount both partitions (remember, you may need to unmount any automatic mounts) | ||
| + | mkdir -p /mnt/base / | ||
| + | sudo mount " | ||
| + | sudo mount " | ||
| + | sudo mount -o noatime, | ||
| + | </ | ||
| + | |||
| + | This should leave you with a writable filesystem in / | ||
| + | |||
| + | ==== Expanding the filesystem ==== | ||
| + | |||
| + | To use the whole available space of your SD card, you may have to resize your partition. | ||
| + | |||
| + | === squashfs image === | ||
| + | |||
| + | First, make sure the partition is not mounted, then do something like: | ||
| + | |||
| + | < | ||
| + | DEVICE= ### Set this appropriately - e.g. /dev/sda | ||
| + | PARTITION=" | ||
| + | sudo cfdisk " | ||
| + | </ | ||
| + | |||
| + | If you've never booted the image that's all there is to it. OpenWrt will create an overlay which uses the rest of this partition on the first boot. | ||
| + | |||
| + | However, if you already booted the image OpenWrt will have created an overlay that is smaller, so you'll need to resize the filesystem. Expand the partition as above, then: | ||
| + | |||
| + | < | ||
| + | # Create a loop device pointing to the FS | ||
| + | # See libfstools/ | ||
| + | FS_SIZE=" | ||
| + | FS_OFFSET=" | ||
| + | LOOP_DEVICE=" | ||
| + | |||
| + | # Now to resize... you may need to use fsck first though. | ||
| + | sudo fsck " | ||
| + | sudo resize2fs " | ||
| + | sudo fsck " | ||
| + | </ | ||
| + | |||
| + | If you get an error from resize2fs about a bad superblock, you probably have an F2FS filesystem. Use '' | ||
| + | |||
| + | === ext4 image === | ||
| + | |||
| + | You can use '' | ||
| + | To do it online, follow the procedure described on [[http:// | ||
| + | |||
| + | Example, to resize ''/ | ||
| + | < | ||
| + | parted | ||
| + | p | ||
| + | resizepart 2 32GB | ||
| + | q | ||
| + | </ | ||
| + | Next, you may need to repair your device (perhaps say yes to all interactive queries): | ||
| + | < | ||
| + | mount -o remount,ro / #Remount root as Read Only | ||
| + | tune2fs -O^resize_inode / | ||
| + | fsck.ext4 / | ||
| + | </ | ||
| + | Now, '' | ||
| + | < | ||
| + | resize2fs / | ||
| + | </ | ||
| ===== Manual disk image assembly ===== | ===== Manual disk image assembly ===== | ||
| Line 32: | Line 126: | ||
| - Copy bootloader, kernel, rootfs (and if necessary other data) to SD card. Details devicespecific? | - Copy bootloader, kernel, rootfs (and if necessary other data) to SD card. Details devicespecific? | ||
| - Possibly resize filesystem in order to use the complete available space on the SD card | - Possibly resize filesystem in order to use the complete available space on the SD card | ||
| - | - ... | ||
| - | ===== Devices with this installation method ===== | ||
| - | ---- datatable ---- | ||
| - | cols : Brand, Model, Versions, Supported Current Rel_releasecurrent, | ||
| - | dynfilters : 1 | ||
| - | filter | ||
| - | filter | ||
| - | sort : Brand | ||
| - | limit : 25 | ||
| - | ---- | ||