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 [2024/05/28 23:56] – [Expanding the filesystem] wryun | 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 ====== | ||
| - | This page provides an overview for OpenWrt | + | OpenWrt |
| ==== Graphical Utilities ==== | ==== Graphical Utilities ==== | ||
| - | Install [[https://www.balena.io/etcher/|Balena Etcher]], a free open source program to flash SD cards on Windows, Linux, or macOS. | + | Install [[https://etcher.balena.io/ |
| - | - Download the correct | + | - Download the image for your device which will be named similar to '' |
| - | - Select the image. | + | - Select the image |
| - | - Select your SD card. | + | - Select your SD card |
| - | - Flash the image. | + | - Flash the image |
| ==== Command Line ==== | ==== Command Line ==== | ||
| - | - Download the image for your device which will be named similar to '' | + | - Download the image for your device which will be named similar to '' |
| - Decompress it: < | - Decompress it: < | ||
| - | - Connect SD card to your computer and look at '' | + | - Connect |
| - | - Double check that you have identified your sd card correctly. If the ''/ | + | - Double check you identified your SD card correctly. If the ''/ |
| - Copy the image to the SD card with: < | - Copy the image to the SD card with: < | ||
| ==== Which image to chose? ==== | ==== Which image to chose? ==== | ||
| - | Often a device has multiple images available which differ in the [[: | + | Most SD card devices have multiple images available which differ in the [[: |
| === ext4-sdcard.img.gz === | === ext4-sdcard.img.gz === | ||
| - | * not optimized for flash memory (journaling increases flash wear) | + | * Not optimized for flash memory (journaling increases flash wear) |
| * SD card can be easily mounted externally for modification | * SD card can be easily mounted externally for modification | ||
| - | * updates | + | * Updates |
| * Linux desktop standard | * Linux desktop standard | ||
| === squashfs-sdcard.img.gz === | === squashfs-sdcard.img.gz === | ||
| - | * compressed | + | * Compressed |
| - | * newer images include a hidden | + | * Newer images include a hidden |
| - | * needs special mount procedure to externally modify | + | * Needs special mount procedure to externally modify |
| - | * all changes are done in an overlay partition | + | * All changes are done in an overlay partition |
| - | * due to overlay partition it is simple to reset system to defaults | + | * Due to overlay partition it is simple to reset system to defaults |
| - | == other images == | + | === Other images |
| * ubifs-sdcard.img.gz | * ubifs-sdcard.img.gz | ||
| - | ==== Mounting a squashfs | + | ==== Mounting a squashfs |
| - | If you insert your newly flashed SD card into a Linux machine, | + | If you insert your newly flashed SD card into a Linux computer |
| + | |||
| + | 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 | ||
| < | < | ||
| Line 58: | Line 59: | ||
| </ | </ | ||
| - | This should leave you with a writable filesystem in / | + | This should leave you with a writable filesystem in / |
| ==== Expanding the filesystem ==== | ==== Expanding the filesystem ==== | ||
| - | To use the whole available space of your sdcard, you probably | + | To use the whole available space of your SD card, you may have to resize your partition. |
| === squashfs image === | === squashfs image === | ||
| - | |||
| - | As with mounting the overlay above, to resize it you'll need the offset of the hidden f2fs or ext4 filesystem (depending on the size of your image, one or the other will be used). | ||
| First, make sure the partition is not mounted, then do something like: | First, make sure the partition is not mounted, then do something like: | ||
| Line 74: | Line 73: | ||
| PARTITION=" | PARTITION=" | ||
| sudo cfdisk " | 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 | # Create a loop device pointing to the FS | ||
| # See libfstools/ | # See libfstools/ | ||
| Line 81: | Line 86: | ||
| LOOP_DEVICE=" | LOOP_DEVICE=" | ||
| - | # Now, resize... you may need to fsck first, though. | + | # Now to resize... you may need to use fsck first though. |
| sudo fsck " | sudo fsck " | ||
| sudo resize2fs " | sudo resize2fs " | ||
| Line 87: | Line 92: | ||
| </ | </ | ||
| - | If you get an error from resize2fs about a bad superblock, you probably have an F2FS filesystem. | + | If you get an error from resize2fs about a bad superblock, you probably have an F2FS filesystem. |
| === ext4 image === | === ext4 image === | ||
| - | You can use gparted to resize and extend the partitions. | + | You can use '' |
| - | To do it online, follow the procedure | + | To do it online, follow the procedure |
| Example, to resize ''/ | Example, to resize ''/ | ||