PageSourceSearch

https://milkv.io/assets/js/8a99d7cf.e3625c7c.js

js milkv.io collected 2026-09-24 19:32:55 UTC 10,334 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunkmilkv_website=self.webpackChunkmilkv_website||[]).push([[601],{72301:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>c,contentTitle:()=>r,default:()=>m,frontMatter:()=>o,metadata:()=>d,toc:()=>a});var i=n(85893),s=n(11151);const o={sidebar_label:"Extend Partition",sidebar_position:30},r="Extend Partition on SD Card or eMMC",d={id:"mars/getting-started/extendpartition",title:"Extend Partition on SD Card or eMMC",description:"The default capacity of the official Debian image root file system is about 4GB. When installing software or other data increases, there will be insufficient space. We can expand the file system to the full capacity of the SD card or eMMC.",source:"@site/docs/mars/getting-started/extendpartition.md",sourceDirName:"mars/getting-started",slug:"/mars/getting-started/extendpartition",permalink:"/docs/mars/getting-started/extendpartition",draft:!1,unlisted:!1,editUrl:"https://github.com/milk-v/milkv.io/edit/main/docs/mars/getting-started/extendpartition.md",tags:[],version:"current",sidebarPosition:30,frontMatter:{sidebar_label:"Extend Partition",sidebar_position:30},sidebar:"mars",previous:{title:"Setting Up",permalink:"/docs/mars/getting-started/setup"},next:{title:"Bootloader Update",permalink:"/docs/mars/getting-started/bootloader"}},c={},a=[{value:"Check the current status of the partitions",id:"check-the-current-status-of-the-partitions",level:2},{value:"Extend a partition using the fdisk command",id:"extend-a-partition-using-the-fdisk-command",level:2}];function l(e){const t={admonition:"admonition",code:"code",h1:"h1",h2:"h2",p:"p",pre:"pre",...(0,s.a)(),...e.components};return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(t.h1,{id:"extend-partition-on-sd-card-or-emmc",children:"Extend Partition on SD Card or eMMC"}),"\n",(0,i.jsxs)(t.p,{children:["The default capacity of the official Debian image root file system is about ",(0,i.jsx)(t.code,{children:"4GB"}),". When installing software or other data increases, there will be insufficient space. We can expand the file system to the full capacity of the SD card or eMMC."]}),"\n",(0,i.jsx)(t.admonition,{type:"tip",children:(0,i.jsxs)(t.p,{children:["Mars is started using eMMC or SD card. The nodes for storage mounting are different. The version of ",(0,i.jsx)(t.code,{children:"eMMC"})," is ",(0,i.jsx)(t.code,{children:"/dev/mmcblk0"})," and the version of ",(0,i.jsx)(t.code,{children:"SD Card"})," is ",(0,i.jsx)(t.code,{children:"/dev/mmcblk1"})]})}),"\n",(0,i.jsxs)(t.p,{children:["The following uses a Mars booted from a 32G SD card as an example to introduce how to expand the capacity through commands. The expansion method for the eMMC version is also the same, just replace ",(0,i.jsx)(t.code,{children:"/dev/mmcblk1"})," with ",(0,i.jsx)(t.code,{children:"/dev/mmcblk0"})," (",(0,i.jsx)(t.code,{children:"/dev/mmcblk1p4"})," with ",(0,i.jsx)(t.code,{children:"/dev/mmcblk0p4"}),")."]}),"\n",(0,i.jsx)(t.h2,{id:"check-the-current-status-of-the-partitions",children:"Check the current status of the partitions"}),"\n",(0,i.jsxs)(t.p,{children:["Use the ",(0,i.jsx)(t.code,{children:"df -h"})," command to view the current partition status"]}),"\n",(0,i.jsx)(t.pre,{children:(0,i.jsx)(t.code,{children:"# df -h\nFilesystem      Size  Used Avail Use% Mounted on\nudev            700M     0  700M   0% /dev\ntmpfs           193M  3.3M  190M   2% /run\n/dev/mmcblk1p4  3.7G  3.1G  590M  85% /\ntmpfs           962M     0  962M   0% /dev/shm\ntmpfs           5.0M   12K  5.0M   1% /run/lock\n/dev/mmcblk1p3  100M   23M   77M  23% /boot\ntmpfs           193M   60K  193M   1% /run/user/110\ntmpfs           193M   24K  193M   1% /run/user/0\n"})}),"\n",(0,i.jsxs)(t.p,{children:["You can see that the device mounted in the current root partition ",(0,i.jsx)(t.code,{children:"/"})," directory is ",(0,i.jsx)(t.code,{children:"/dev/mmcblk1p4"})]}),"\n",(0,i.jsx)(t.h2,{id:"extend-a-partition-using-the-fdisk-command",children:"Extend a partition using the fdisk command"}),"\n",(0,i.jsxs)(t.p,{children:["Entering the ",(0,i.jsx)(t.code,{children:"fdisk"})," command will take you into the command-line interactive mode of ",(0,i.jsx)(t.code,{children:"fdisk"})]}),"\n",(0,i.jsx)(t.pre,{children:(0,i.jsx)(t.code,{children:"# fdisk /dev/mmcblk1\n"})}),"\n",(0,i.jsxs)(t.p,{children:["Enter the ",(0,i.jsx)(t.code,{children:"p"})," command to view the current partition information. You can see that the current capacity of the system partition ",(0,i.jsx)(t.code,{children:"/dev/mmcblk1p4"})," is ",(0,i.jsx)(t.code,{children:"3.8G"})]}),"\n",(0,i.jsx)(t.pre,{children:(0,i.jsx)(t.code,{children:"Command (m for help): p\n\nDisk /dev/mmcblk1: 29.12 GiB, 31267487744 bytes, 61069312 sectors\nUnits: sectors of 1 * 512 = 512 bytes\nSector size (logical/physical): 512 bytes / 512 bytes\nI/O size (minimum/optimal): 512 bytes / 512 bytes\nDisklabel type: gpt\nDisk identifier: 2D487F15-E07F-4B07-BC04-80EA297E8675\n\nDevice          Start     End Sectors  Size Type\n/dev/mmcblk1p1   4096    8191    4096    2M HiFive BBL\n/dev/mmcblk1p2   8192   16383    8192    4M HiFive FSBL\n/dev/mmcblk1p3  16384  221183  204800  100M EFI System\
1n/dev/mmcblk1p4 221184 8189918 7968735  3.8G Linux filesystem\n"})}),"\n",(0,i.jsxs)(t.p,{children:["Then execute the ",(0,i.jsx)(t.code,{children:"d"})," command to delete the system partition from the original system. You will be prompted to enter the partition number to be deleted. We want to delete ",(0,i.jsx)(t.code,{children:"/dev/mmcblk1p4"}),", so enter ",(0,i.jsx)(t.code,{children:"4"})]}),"\n",(0,i.jsx)(t.pre,{children:(0,i.jsx)(t.code,{children:"Command (m for help): d\nPartition number (1-4, default 4): 4\n\nPartition 4 has been deleted.\n\nCommand (m for help):\n"})}),"\n",(0,i.jsxs)(t.p,{children:["Then use the ",(0,i.jsx)(t.code,{children:"n"})," command to create a new partition. It prompts you to enter the partition number. We still use ",(0,i.jsx)(t.code,{children:"/dev/mmcblk1p4"}),", so enter ",(0,i.jsx)(t.code,{children:"4"}),"."]}),"\n",(0,i.jsxs)(t.p,{children:["The following prompt ",(0,i.jsx)(t.code,{children:"First sector"})," requires you to enter the starting sector value of the new partition. The command it has helped us identify the default starting value (",(0,i.jsx)(t.code,{children:"default 221184"}),"), which is the starting sector of the just deleted ",(0,i.jsx)(t.code,{children:"/dev/mmcblk1p4"}),", so you can just press Enter without entering value."]}),"\n",(0,i.jsxs)(t.p,{children:["Finally enter the size of the new partition. The default ",(0,i.jsx)(t.code,{children:'"default"'}),' value is the entire storage space, there is no need to enter a specific value, just press Enter and it will prompt "Do you want to remove the signature? [Y]es/[N]o:" Enter ',(0,i.jsx)(t.code,{children:"No"})]}),"\n",(0,i.jsx)(t.pre,{children:(0,i.jsx)(t.code,{children:"Command (m for help): n\nPartition number (4-128, default 4): 4\nFirst sector (34-61069278, default 221184): \nLast sector, +/-sectors or +/-size{K,M,G,T,P} (221184-61069278, default 61067263): \n\nCreated a new partition 4 of type 'Linux filesystem' and of size 29 GiB.\nPartition #4 contains a ext4 signature.\n\nDo you want to remove the signature? [Y]es/[N]o: No\n\nCommand (m for help):\n"})}),"\n",(0,i.jsxs)(t.p,{children:["Execute the ",(0,i.jsx)(t.code,{children:"p"})," command to check the current partition situation. ",(0,i.jsx)(t.code,{children:"/dev/mmcblk1p4"})," has been expanded to the entire storage space. Here it is ",(0,i.jsx)(t.code,{children:"29G"})]}),"\n",(0,i.jsx)(t.pre,{children:(0,i.jsx)(t.code,{children:"Command (m for help): p\n\nDisk /dev/mmcblk1: 29.12 GiB, 31267487744 bytes, 61069312 sectors\nUnits: sectors of 1 * 512 = 512 bytes\nSector size (logical/physical): 512 bytes / 512 bytes\nI/O size (minimum/optimal): 512 bytes / 512 bytes\nDisklabel type: gpt\nDisk identifier: 2D487F15-E07F-4B07-BC04-80EA297E8675\n\nDevice          Start      End  Sectors  Size Type\n/dev/mmcblk1p1   4096     8191     4096    2M HiFive BBL\n/dev/mmcblk1p2   8192    16383     8192    4M HiFive FSBL\n/dev/mmcblk1p3  16384   221183   204800  100M EFI System\n/dev/mmcblk1p4 221184 61067263 60846080   29G Linux filesystem\n\nCommand (m for help):\n"})}),"\n",(0,i.jsxs)(t.p,{children:["Execute the ",(0,i.jsx)(t.code,{children:"w"})," command to save changes and exit ",(0,i.jsx)(t.code,{children:"fdisk"})," interactive mode"]}),"\n",(0,i.jsx)(t.pre,{children:(0,i.jsx)(t.code,{children:"Command (m for help): w\nThe partition table has been altered.\nSyncing disks.\n"})}),"\n",(0,i.jsxs)(t.p,{children:["Finally, execute the ",(0,i.jsx)(t.code,{children:"resize2fs"})," command to complete the file system expansion"]}),"\n",(0,i.jsx)(t.pre,{children:(0,i.jsx)(t.code,{children:"# resize2fs /dev/mmcblk1p4\nresize2fs 1.46.6-rc1 (12-Sep-2022)\nFilesystem at /dev/mmcblk1p4 is mounted on /; on-line resizing required\nold_desc_blocks = 1, new_desc_blocks = 4\nThe filesystem on /dev/mmcblk1p4 is now 7605760 (4k) blocks long.\n"})}),"\n",(0,i.jsxs)(t.p,{children:["Use the ",(0,i.jsx)(t.code,{children:"df -h"})," command again to check the partition status. You can see that the system partition node ",(0,i.jsx)(t.code,{children:"/dev/mmcblk1p4"})," has been expanded to ",(0,i.jsx)(t.code,{children:"29G"})]}),"\n",(0,i.jsx)(t.pre,{children:(0,i.jsx)(t.code,{children:"# df -h\nFilesystem      Size  Used Avail Use% Mounted on\nudev            700M     0  700M   0% /dev\ntmpfs           193M  3.3M  190M   2% /run\n/dev/mmcblk1p4   29G  3.1G   26G  11% /\ntmpfs           962M     0  962M   0% /dev/shm\ntmpfs           5.0M   12K  5.0M   1% /run/lock\ntmpfs           193M   64K  193M   1% /run/user/110\ntmpfs           193M   24K  193M   1% /run/user/0\n/dev/mmcblk1p3  100M   23M   77M  23% /boot\n"})})]})}function m(e={}){const{wrapper:t}={...(0,s.a)(),...e.components};return t?(0,i.jsx)(t,{...e,children:(0,i.jsx)(l,{...e})}):l(e)}},11151:(e,t,n)=>{n.d(t,{Z:()=>d,a:()=>r});var i=n(67294);const s={},o=i.createContext(s);function r(e){const t=i.useContext(o);return i.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function d(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(s):e.components||s:r(e.components),i.createElement(o.Provider,{value:t},e.children)}}}]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.