<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.alpinelinux.org/w/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Leonclx</id>
	<title>Alpine Linux - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.alpinelinux.org/w/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Leonclx"/>
	<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/wiki/Special:Contributions/Leonclx"/>
	<updated>2026-04-29T02:07:26Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.40.0</generator>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Finding_the_fastest_mirror&amp;diff=22657</id>
		<title>Finding the fastest mirror</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Finding_the_fastest_mirror&amp;diff=22657"/>
		<updated>2022-11-10T18:47:02Z</updated>

		<summary type="html">&lt;p&gt;Leonclx: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;After you install Alpine, you may be wondering how do I figure out the fastest mirror again?&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Don&#039;t use this script, it&#039;s broken&#039;&#039;&#039;&lt;br /&gt;
{{Cat|/home/user/fastestmirror|&amp;lt;nowiki&amp;gt;&lt;br /&gt;
data=&amp;quot;&amp;quot;&lt;br /&gt;
for s in $(wget -qO- http://rsync.alpinelinux.org/alpine/MIRRORS.txt); do&lt;br /&gt;
        t=$(time -f &amp;quot;%E&amp;quot; wget -q $s/MIRRORS.txt -O /dev/null 2&amp;gt;&amp;amp;1)&lt;br /&gt;
        echo &amp;quot;$s was $t&amp;quot;&lt;br /&gt;
        data=&amp;quot;$data$t $s\n&amp;quot;&lt;br /&gt;
done&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;===RESULTS===&amp;quot;&lt;br /&gt;
&lt;br /&gt;
echo -e $data | sort&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This is more advanced implementation.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Don&#039;t use this script, it&#039;s broken&#039;&#039;&#039;&lt;br /&gt;
{{Cat|/etc/apk/fastest-mirror|&amp;lt;nowiki&amp;gt;&lt;br /&gt;
#!/bin/sh&lt;br /&gt;
get_hostname_url() {&lt;br /&gt;
  local n=${1#*://}&lt;br /&gt;
  echo ${n%%/*}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
time_cmd() {&lt;br /&gt;
  local proc=$(cut -d &#039; &#039; -f1 /proc/uptime)&lt;br /&gt;
  local start=&amp;quot;$(echo $proc | cut -d . -f1)$(echo $proc | cut -d . -f2)&amp;quot;&lt;br /&gt;
  $@ &amp;gt;/dev/null 2&amp;gt;&amp;amp;1 || return&lt;br /&gt;
  proc=$(cut -d &#039; &#039; -f1 /proc/uptime)&lt;br /&gt;
  local end=&amp;quot;$(echo $proc | cut -d . -f1)$(echo $proc | cut -d . -f2)&amp;quot; &lt;br /&gt;
  echo $(( $end - $start  ))&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
DATA=&amp;quot;&amp;quot;&lt;br /&gt;
MIRRORS=$(wget -qO- &amp;quot;http://rsync.alpinelinux.org/alpine/MIRRORS.txt&amp;quot;)&lt;br /&gt;
DST=/etc/apk/mirrors.txt&lt;br /&gt;
&lt;br /&gt;
#find best&lt;br /&gt;
for URL in $MIRRORS; do&lt;br /&gt;
	TIME=$(time_cmd wget -T 1 -t 1 -q ${URL%/} -O /dev/null)&lt;br /&gt;
	if [ -n &amp;quot;$TIME&amp;quot; ]; then	&lt;br /&gt;
		echo &amp;quot;$(get_hostname_url $URL) was $TIME&amp;quot;&lt;br /&gt;
		DATA=&amp;quot;$DATA$TIME $URL\n&amp;quot;&lt;br /&gt;
	fi&lt;br /&gt;
done&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
echo $DATA | sort -n | tail -n +2 &amp;gt; $DST&lt;br /&gt;
[ $? = 0 ] &amp;amp;&amp;amp; echo file $DST created&lt;br /&gt;
&lt;br /&gt;
BEST=$(head -n1 $DST | cut -d &#039; &#039; -f2)&lt;br /&gt;
echo &amp;quot;Best mirror is: $BEST&amp;quot;&lt;br /&gt;
&lt;br /&gt;
sed -i -r &#039;s#^http.+/(.+/main)#&#039;${BEST%/}&#039;/\1#&#039; /etc/apk/repositories&lt;br /&gt;
sed -i -r &#039;s#^http.+/(.+/community)#&#039;${BEST%/}&#039;/\1#&#039; /etc/apk/repositories&lt;br /&gt;
sed -i -r &#039;s#^http.+/(.+/testing)#&#039;${BEST%/}&#039;/\1#&#039; /etc/apk/repositories&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Package Manager]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Package Manager]]&lt;/div&gt;</summary>
		<author><name>Leonclx</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Setting_up_disks_manually&amp;diff=22346</id>
		<title>Setting up disks manually</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Setting_up_disks_manually&amp;diff=22346"/>
		<updated>2022-10-02T08:34:06Z</updated>

		<summary type="html">&lt;p&gt;Leonclx: added instructions for custom boot partition size&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
The menu choices that are provided by &amp;lt;code&amp;gt;setup-alpine&amp;lt;/code&amp;gt; can not cover all needs, however, it&#039;s possible to:&lt;br /&gt;
&lt;br /&gt;
* Call [[Alpine_setup_scripts#setup-disk|setup-disk]] directly, instead of through &amp;lt;code&amp;gt;setup-alpine&amp;lt;/code&amp;gt;, and pass some specific partitioning parameters to it.&lt;br /&gt;
* Set up the partitions and filesystems manually (to the desired details) and [[Alpine_setup_scripts#Partitioning|tell setup-disk]] to install to the prepared target mountpoint.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
(Beta refenence: [https://docs.alpinelinux.org/user-handbook/0.1a/Installing/manual.html#_finalizing docs.alpinelinux.org] )&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Using setup-alpine (setup-disk) features =&lt;br /&gt;
&lt;br /&gt;
== For &amp;quot;diskless&amp;quot; and &amp;quot;data&amp;quot; disk mode installs ==&lt;br /&gt;
&lt;br /&gt;
This requires some manual steps, as long as the setup-scripts auto-detect usable partitions only on *removable* devices (not internal harddisks). They do not support creating new, writable partitions to be used by Alpine.&lt;br /&gt;
&lt;br /&gt;
How to prepare writable storage space is explained in the section [[Setting_up_disks_manually#Manual_partitioning| manual partitioning]], below.&lt;br /&gt;
&lt;br /&gt;
== For &amp;quot;sys&amp;quot; disk mode installs ==&lt;br /&gt;
&lt;br /&gt;
{{Draft|Some information on this page may be incomplete or outdate.}}&lt;br /&gt;
&lt;br /&gt;
=== Disk layouts ===&lt;br /&gt;
&lt;br /&gt;
It is possible to have one or more of RAID, encrypted, and/or Logical Volume on your {{Path|/}} (root) volume. However, the Alpine init script only knows how to handle them when they&#039;re layered in that order, and your initram and extlinux.conf files in the {{Path|/boot}} partition are configured properly.&lt;br /&gt;
&lt;br /&gt;
Your {{Path|/boot}} directory cannot reside on an encrypted or LVM volume, at least not with Alpine&#039;s default bootloader (extlinux). (Grub2 can deal with {{Path|/boot}} being on an LVM volume.) The usual practice is to create a small partition for {{Path|/boot}}, then devote the rest of your disk to a separate partition on which you layer one or more of RAID, encryption, and/or Logical Volumes.&lt;br /&gt;
&lt;br /&gt;
Sometimes {{Path|/boot}} is also set up as a mirrored (RAID1) volume. However, this is just for post-init access. That way, when you write a new kernel or bootloader config file to {{Path|/boot}}, it gets written to multiple physical partitions. During the pre-init, bootloader phase, only one of those partitions will be read from.&lt;br /&gt;
&lt;br /&gt;
A typical setup might look like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
One-disk system&lt;br /&gt;
---------------&lt;br /&gt;
  +------------------------------------------------+&lt;br /&gt;
  |  small partition (32--100M), holding           |&lt;br /&gt;
  |  only /boot, filesystem needn&#039;t be journaled   |&lt;br /&gt;
  +------------------------------------------------+&lt;br /&gt;
  |  rest of disk in second partition              |&lt;br /&gt;
  |  +------------------------------------------+  |&lt;br /&gt;
  |  | cryptsetup volume                        |  |&lt;br /&gt;
  |  |  +-------------------------------------+ |  |&lt;br /&gt;
  |  |  |  LVM PV, containing single VG,      | |  |&lt;br /&gt;
  |  |  |  containing multiple LVs, holding   | |  |&lt;br /&gt;
  |  |  |  /, /home, swap, etc                | |  |&lt;br /&gt;
  |  |  +-------------------------------------+ |  |&lt;br /&gt;
  |  +------------------------------------------+  |&lt;br /&gt;
  +------------------------------------------------+&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Two-disk system&lt;br /&gt;
---------------&lt;br /&gt;
  +------------------------------------------------+  +------------------------------------------------+&lt;br /&gt;
  |  small partition (32--100M), holding           |  |  small partition (32--100M), holding           | These 2 partitions might&lt;br /&gt;
  |  only /boot, filesystem needn&#039;t be journaled   |  |  only /boot, filesystem needn&#039;t be journaled   | form a mirrored (RAID1)&lt;br /&gt;
  +------------------------------------------------+  +------------------------------------------------+ volume&lt;br /&gt;
  |  rest of disk in second partition              |  |  rest of disk in second partition              |&lt;br /&gt;
  | T================================================================================================T | These 2 partitions form&lt;br /&gt;
  | T +--------------------------------------------------------------------------------------------+ T | a second mirrored&lt;br /&gt;
  | T | cryptsetup volume                                                                          | T | (RAID1) volume&lt;br /&gt;
  | T |  +---------------------------------------------------------------------------------------+ | T |&lt;br /&gt;
  | T |  | LVM PV, containing single VG,                                                         | | T |&lt;br /&gt;
  | T |  | containing multiple LVs, holding                                                      | | T |&lt;br /&gt;
  | T |  | /, /home, swap, etc                                                                   | | T |&lt;br /&gt;
  | T |  +---------------------------------------------------------------------------------------+ | T |&lt;br /&gt;
  | T +--------------------------------------------------------------------------------------------+ T |&lt;br /&gt;
  | T================================================================================================T |&lt;br /&gt;
  |                                                |  |                                                |&lt;br /&gt;
  +------------------------------------------------+  +------------------------------------------------+&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In a three-disk system, the {{Path|/boot}} would still be RAID1, but the larger partition might, in that case, be RAID5.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== RAID ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;setup-disk&amp;lt;/code&amp;gt; will automatically build a RAID array if you supply the &#039;&#039;&#039;-r&#039;&#039;&#039; switch, or if you specify more than one device.&lt;br /&gt;
&lt;br /&gt;
If you want to build your RAID array manually, see [[Setting up a software RAID array]]. Then you can add additional layers of encryption and/or Logical Volumes, or just assemble the RAID array, and supply the {{Path|/dev/md&amp;lt;i&amp;gt;i&amp;lt;/i&amp;gt;}} device directly to [[setup-disk]]. When you&#039;re finished, be sure to disassemble the RAID array before rebooting.&lt;br /&gt;
&lt;br /&gt;
If &amp;lt;code&amp;gt;setup-disk&amp;lt;/code&amp;gt; sees that you&#039;re using RAID, either because you gave it the &amp;lt;code&amp;gt;-r&amp;lt;/code&amp;gt; switch, or multiple devices, or a {{Path|/dev/md&amp;lt;i&amp;gt;i&amp;lt;/i&amp;gt;}} device, then it will set up your initramfs and extlinux.conf file properly. However, in other cases, such as when you&#039;re also using encryption, or you invoke &amp;lt;code&amp;gt;setup-disk&amp;lt;/code&amp;gt; with a mounted directory argument, these might not be properly set up for RAID. In that case, you may need to manually edit/rebuild them. The following assumes that &amp;lt;code&amp;gt;$MNT&amp;lt;/code&amp;gt; holds the root directory you&#039;re installing into:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|1=echo &amp;quot;/sbin/mdadm&amp;quot; &amp;gt; $MNT/etc/mkinitfs/files.d/raid&lt;br /&gt;
echo &amp;quot;/etc/mdadm.conf&amp;quot; &amp;gt;&amp;gt; $MNT/etc/mkinitfs/files.d/raid&lt;br /&gt;
&amp;amp;#35; edit $MNT/etc/mkinitfs/mkinitfs.conf to make sure features=&amp;quot;...&amp;quot;&lt;br /&gt;
&amp;amp;#35; includes raid (this field is space-separated and quoted)&lt;br /&gt;
mkinitfs -c $MNT/etc/mkinitfs/mkinitfs.conf -b $MNT&lt;br /&gt;
&amp;amp;#35; edit $MNT/etc/update-extlinux.conf to make sure modules=... contains&lt;br /&gt;
&amp;amp;#35; raid1 or raid456 (whichever your / is on; this field is comma-separated)&lt;br /&gt;
&amp;amp;#35; also check the root= setting&lt;br /&gt;
extlinux --raid --install $MNT/boot --update&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
{{Todo|Does adding the &amp;lt;code&amp;gt;--update&amp;lt;/code&amp;gt; option to &amp;lt;code&amp;gt;extlinux ...&amp;lt;/code&amp;gt; suffice to make {{Path|/boot/extlinux.conf}} be regenerated? Or do we need to manually tweak that file, or run &amp;lt;code&amp;gt;update-extlinux&amp;lt;/code&amp;gt;, as well?}}&lt;br /&gt;
&lt;br /&gt;
You might also need to manually tweak {{Path|$MNT/etc/fstab}}. And you might need to copy {{Path|/usr/share/syslinux/mbr.bin}} to your disk&#039;s MBR.&lt;br /&gt;
&lt;br /&gt;
=== Encryption ===&lt;br /&gt;
&lt;br /&gt;
See [[Setting up encrypted volumes with LUKS]]. You can add an additional Logical Volume layer, or just unlock the volume you&#039;ve created (using &amp;lt;code&amp;gt;cryptsetup luksOpen ...&amp;lt;/code&amp;gt;), and supply the {{Path|/dev/mapper/&amp;lt;i&amp;gt;something&amp;lt;/i&amp;gt;}} device directly to [[setup-disk]]. When you&#039;re finished, be sure to relock the volume (using &amp;lt;code&amp;gt;cryptsetup luksClose ...&amp;lt;/code&amp;gt;) before rebooting.&lt;br /&gt;
&lt;br /&gt;
If you install your {{Path|/}} (root) on an encrypted volume, you&#039;ll need to manually edit/rebuild your initram and your extlinux.conf file. The following assumes that &amp;lt;code&amp;gt;$MNT&amp;lt;/code&amp;gt; holds the root directory you&#039;re installing into, that you&#039;ve created the cryptvolume on the device {{Path|/dev/md2}}, and that you want to unlock the encrypted volume into a virtual volume named &amp;quot;crypt&amp;quot;:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|1=&amp;amp;#35; edit $MNT/etc/mkinitfs/mkinitfs.conf to make sure features=&amp;quot;...&amp;quot;&lt;br /&gt;
&amp;amp;#35; includes cryptsetup (this field is space-separated and quoted)&lt;br /&gt;
mkinitfs -c $MNT/etc/mkinitfs/mkinitfs.conf -b $MNT&lt;br /&gt;
&amp;amp;#35; edit $MNT/etc/update-extlinux.conf to make sure default_kernel_opts=&amp;quot;...&amp;quot;&lt;br /&gt;
&amp;amp;#35; contains cryptroot=/dev/md1 and cryptdm=crypt (this field is also space-separated and quoted)&lt;br /&gt;
&amp;amp;#35; also check the root= setting&lt;br /&gt;
extlinux --install $MNT/boot --update&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
{{Todo|Does adding the &amp;lt;code&amp;gt;--update&amp;lt;/code&amp;gt; option to &amp;lt;code&amp;gt;extlinux ...&amp;lt;/code&amp;gt; suffice to make {{Path|/boot/extlinux.conf}} be regenerated? Or do we need to manually tweak that file, or run &amp;lt;code&amp;gt;update-extlinux&amp;lt;/code&amp;gt;, as well?}}&lt;br /&gt;
&lt;br /&gt;
You might also need to manually tweak {{Path|$MNT/etc/fstab}}.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== LVM ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;setup-disk&amp;lt;/code&amp;gt; will automatically build and use volumes in a LVM group if you supply the &#039;&#039;&#039;-L&#039;&#039;&#039; switch.&lt;br /&gt;
&lt;br /&gt;
If you instead want to build your LVM system manually, see [[Setting up Logical Volumes with LVM]]. Then &amp;lt;code&amp;gt;vgchange -ay&amp;lt;/code&amp;gt;, format and mount your volumes, and supply the root mountpoint to [[setup-disk]]. When you&#039;re finished, be sure to&lt;br /&gt;
{{Cmd|umount ...&lt;br /&gt;
vgchange -an}}&lt;br /&gt;
before rebooting.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If &amp;lt;code&amp;gt;setup-disk&amp;lt;/code&amp;gt; sees that you&#039;re using LVM, perhaps because you gave it the &amp;lt;code&amp;gt;-L&amp;lt;/code&amp;gt; switch, then it will set up your initram and extlinux.conf file properly. However, in other cases, these might not be properly set up. In that case, you may need to manually edit/rebuild them. The following assumes that &amp;lt;code&amp;gt;$MNT&amp;lt;/code&amp;gt; holds the root directory you&#039;re installing into:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|1=&amp;amp;#35; edit $MNT/etc/mkinitfs/mkinitfs.conf to make sure features=&amp;quot;...&amp;quot;&lt;br /&gt;
&amp;amp;#35; includes lvm (this field is space-separated and quoted)&lt;br /&gt;
mkinitfs -c $MNT/etc/mkinitfs/mkinitfs.conf -b $MNT&lt;br /&gt;
&amp;amp;#35; edit $MNT/etc/update-extlinux.conf to make sure root= is set correctly&lt;br /&gt;
extlinux --install $MNT/boot --update&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
{{Todo|Does adding the &amp;lt;code&amp;gt;--update&amp;lt;/code&amp;gt; option to &amp;lt;code&amp;gt;extlinux ...&amp;lt;/code&amp;gt; suffice to make {{Path|/boot/extlinux.conf}} be regenerated? Or do we need to manually tweak that file, or run &amp;lt;code&amp;gt;update-extlinux&amp;lt;/code&amp;gt;, as well?}}&lt;br /&gt;
&lt;br /&gt;
You might also need to manually tweak {{Path|$MNT/etc/fstab}}.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Manual partitioning =&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== For &amp;quot;diskless&amp;quot; and &amp;quot;data&amp;quot; disk mode installs ==&lt;br /&gt;
&lt;br /&gt;
The installation image enviroment may have only the very basic busybox built-in &amp;lt;code&amp;gt;fdisk&amp;lt;/code&amp;gt; command available. However, alpine allows you to install more complete partitioning tool packages like &amp;lt;code&amp;gt;sfdisk&amp;lt;/code&amp;gt; (scriptable fdisk), &amp;lt;code&amp;gt;gptfdisk&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;parted&amp;lt;/code&amp;gt; (CLI), &amp;lt;code&amp;gt;cfdisk&amp;lt;/code&amp;gt; (text menus), or even &amp;lt;code&amp;gt;gparted&amp;lt;/code&amp;gt; (after [[Installation#Post-Install|setting up a graphical environment]]).&lt;br /&gt;
&lt;br /&gt;
The following example installs &amp;lt;code&amp;gt;cfdisk&amp;lt;/code&amp;gt;, looks for existing partitions, and runs cfdisk against &amp;lt;code&amp;gt;/dev/sdX&amp;lt;/code&amp;gt;:&lt;br /&gt;
 # apk add cfdisk&lt;br /&gt;
 # blkid&lt;br /&gt;
 /dev/sdX1: LABEL=&amp;quot;some&amp;quot; UUID=&amp;quot;...&amp;quot; TYPE=&amp;quot;vfat&amp;quot;&lt;br /&gt;
 /dev/sdX2: LABEL=&amp;quot;other&amp;quot; UUID=&amp;quot;...&amp;quot; TYPE=&amp;quot;ext4&amp;quot;&lt;br /&gt;
 # cfdisk /dev/sdX&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* Be aware of this Bug: [https://gitlab.alpinelinux.org/alpine/aports/-/issues/11589 The APKOVL loading of diskless setups doesn&#039;t work on btrfs and xfs filesystems, or nvme-based devices] =&amp;gt; So, for the moment, use only ext4 filesystem partitions on classic drives to store diskless mode states.&lt;br /&gt;
&lt;br /&gt;
The following creates an ext4 partition with disabled journaling, to reduce write operations and allow the disk to spin down after the .apkovl and the packages have been read from the partition during the boot.&lt;br /&gt;
 # apk add e2fsprogs&lt;br /&gt;
 # mkfs.ext4 -O ^has_journal /dev/sdXY   # the &amp;quot;-O ^has_journal&amp;quot; DISABLES journaling (&amp;quot;^&amp;quot; means &amp;quot;not&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
{{Note|IMPORTANT! There may be additional steps necessary to make proper use of the partition, see&lt;br /&gt;
[[Alpine_local_backup#Saving_and_loading_ISO_image_customizations|Saving_and_loading_ISO_image_customizations]].&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
== For &amp;quot;sys&amp;quot; disk mode installs ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;setup-disk&amp;lt;/code&amp;gt; will by default set up a root partition, a separate /boot partition and a swap partition. If you want a different layout, you can manually create the partitions, filesystems and mount them on {{Path|/mnt}} (or any other mount point) then run:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|setup-disk /mnt}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;setup-disk&amp;lt;/code&amp;gt; will install your running system on the mounted root, detect your file system layout and generate an fstab.&lt;br /&gt;
&lt;br /&gt;
If you&#039;re using the MBR, you are responsible for making the proper partition bootable and make sure the MBR is OK for extlinux. If you&#039;re going to use EFI, make sure you mount &amp;lt;code&amp;gt;esp&amp;lt;/code&amp;gt; partition on &amp;lt;code&amp;gt;/boot/efi&amp;lt;/code&amp;gt; and set &amp;lt;code&amp;gt;BOOTLOADER=grub&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;USE_EFI=1&amp;lt;/code&amp;gt;, and that {{Pkg|grub-efi}} and {{Pkg|efibootmgr}} are installed before running &amp;lt;code&amp;gt;setup-disk&amp;lt;/code&amp;gt;. If your system still does not boot, you can try to manually create a boot entry with {{Pkg|efibootmgr}}, for which instructions can be found at [https://wiki.alpinelinux.org/wiki/Bootloaders#efibootmgr EFI Boot Stub].&lt;br /&gt;
&lt;br /&gt;
See also [https://github.com/itoffshore/alpine-linux-scripts setup-partitions]&lt;br /&gt;
&lt;br /&gt;
=== Dual-booting ===&lt;br /&gt;
See [[Installing Alpine on HDD dualbooting|Install to HDD with dual-boot]]&lt;br /&gt;
&lt;br /&gt;
=== Other needs ===&lt;br /&gt;
* [[Installing Alpine Linux in a chroot]]&lt;br /&gt;
* [[Replacing non-Alpine Linux with Alpine remotely]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
 Create partition with with type &amp;quot;Linux&amp;quot; (83).&lt;br /&gt;
 apk_add e2fsprogs rsync&lt;br /&gt;
 mkfs.ext3 /dev/hda1&lt;br /&gt;
 mount -t ext3 /dev/hda1 /mnt&lt;br /&gt;
 ROOT=/mnt apk_add uclibc busybox apk-tools alpine-baselayout alpine-conf&lt;br /&gt;
 # Install busybox links&lt;br /&gt;
 mkdir /mnt/proc &amp;amp;&amp;amp; mount --bind /proc /mnt/proc &amp;amp;&amp;amp; chroot /mnt /bin/busybox --install -s &amp;amp;&amp;amp; umount /mnt/proc&lt;br /&gt;
 # Copy the apk repository&lt;br /&gt;
 rsync -ruav /media/cdrom/apks /mnt&lt;br /&gt;
 mkdir /mnt/etc/apk &amp;amp;&amp;amp; echo &amp;quot;APK_PATH=file://apks&amp;quot; &amp;gt; /mnt/etc/apk/apk.conf&lt;br /&gt;
 # Copy the hd/ext3 initramfs image, kernel and kernel modules&lt;br /&gt;
 rsync -ruav /media/cdrom/kernel/generic/hd-ext3.gz /media/cdrom/kernel/generic/bzImage /mnt&lt;br /&gt;
 rsync -ruav /lib/modules/* /mnt/lib/modules/&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
== Setting up RAID ==&lt;br /&gt;
Set up a raid array as described [[Setting up a software RAID1 array|here]].&lt;br /&gt;
In this document, two raid arrays are configured: md0 for swap (512MB) and md1 for /var. &lt;br /&gt;
&lt;br /&gt;
== Create filesystem ==&lt;br /&gt;
We need to install the software to create the filesystem (&amp;quot;format&amp;quot; the partition).&lt;br /&gt;
 apk_add e2fsprogs&lt;br /&gt;
&lt;br /&gt;
If you use an Alpine release older than 1.3.8 you will need to manually create a link to /etc/mtab.&lt;br /&gt;
 ln -fs /proc/mounts /etc/mtab&lt;br /&gt;
&lt;br /&gt;
Create the filesystem. The -j option makes it ext&#039;&#039;&#039;3&#039;&#039;&#039;. Without the -j option it will become non-journaling ext&#039;&#039;&#039;2&#039;&#039;&#039;. This step might take some time if your partition is big.&lt;br /&gt;
 mke2fs -j /dev/md1&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now edit /etc/fstab and add your new partitions. Mine looks like this:&lt;br /&gt;
 none            /proc           proc    defaults 0 0&lt;br /&gt;
 none            /sys            sysfs   defaults 0 0&lt;br /&gt;
 udev            /dev            tmpfs   size=100k 0 0&lt;br /&gt;
 none            /dev/pts        devpts  defaults 0 0&lt;br /&gt;
 tmpfs           /dev/shm        tmpfs   defaults 0 0&lt;br /&gt;
 /dev/cdrom      /media/cdrom    iso9660 ro 0 0&lt;br /&gt;
 /dev/fd0        /media/floppy   vfat    noauto  0 0&lt;br /&gt;
 /dev/usba1      /media/usb      vfat    noauto  0 0&lt;br /&gt;
 none            /proc/bus/usb   usbfs noauto 0 0&lt;br /&gt;
  &lt;br /&gt;
 /dev/md0        swap            swap    defaults 0 0&lt;br /&gt;
 /dev/md1        /var            ext3    defaults 0 0&lt;br /&gt;
&lt;br /&gt;
== Move the data ==&lt;br /&gt;
Stop aall services running that put anything in /var (syslog for example). If you have booted on a clean installation and not run setup-alpine, then no services should be running. However, some packages might have created dirs in /var, so we need to backup /var, mount the new /var directory and move all backed up dirs to the raided /var.&lt;br /&gt;
&lt;br /&gt;
 mv /var /var.tmp&lt;br /&gt;
 mkdir /var&lt;br /&gt;
 mount /var&lt;br /&gt;
 mv /var.tmp/* /var&lt;br /&gt;
 rmdir /var.tmp&lt;br /&gt;
&lt;br /&gt;
Verify that everyting looks ok with the &#039;&#039;df&#039;&#039; utility.&lt;br /&gt;
 ~ $ df&lt;br /&gt;
 Filesystem           1k-blocks      Used Available Use% Mounted on&lt;br /&gt;
 none                    255172     23544    231628   9% /&lt;br /&gt;
 udev                       100         0       100   0% /dev&lt;br /&gt;
 /dev/cdrom              142276    142276         0 100% /media/cdrom&lt;br /&gt;
 /dev/md1              37977060    181056  35866876   1% /var&lt;br /&gt;
&lt;br /&gt;
== Survive reboots ==&lt;br /&gt;
Now we have everything up and running. We need to make sure that everything will be restored during next reboot.&lt;br /&gt;
&lt;br /&gt;
Create an initscript that will mount /var for you during boot. I call it /etc/init.d/mountdisk and it looks like this:&lt;br /&gt;
 #!/sbin/runscript&lt;br /&gt;
 &lt;br /&gt;
 start() {&lt;br /&gt;
         ebegin &amp;quot;Mounting /var&amp;quot;&lt;br /&gt;
         mount /var&lt;br /&gt;
         eend $?&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 stop() {&lt;br /&gt;
         ebegin &amp;quot;Unmounting /var&amp;quot;&lt;br /&gt;
         umount /var&lt;br /&gt;
         eend $?&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
Make it exectutable:&lt;br /&gt;
 chmod +x /etc/init.d/mountdisk&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;NOTE:&#039;&#039;&#039; Since Alpine-1.7.3 a script named &#039;&#039;localmount&#039;&#039; is included so you will not need to create your own &#039;&#039;mountdisk&#039;&#039; script.&lt;br /&gt;
&lt;br /&gt;
/var needs to be mounted *after* raid is created. The -k option will make alpine unmount the /var partition during boot. Add start swap to boot:&lt;br /&gt;
 rc_add -k -s 06 mountdisk&lt;br /&gt;
 rc_add -k -s 06 swap&lt;br /&gt;
&lt;br /&gt;
The /dev/md* device nodes will not be created automatically, so we need to put them on floppy too.&lt;br /&gt;
 lbu include /dev/md*&lt;br /&gt;
&lt;br /&gt;
If you have users on the server and want /home to be permanent, you can create a directory /var/home and create links to /var/home.&lt;br /&gt;
 mkdir /var/home&lt;br /&gt;
 mv /home/* /var/home/&lt;br /&gt;
 ln -s /var/home/* /home/&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;NOTE:&#039;&#039;&#039; You cannot just replace /home with a link that points to /var/home since the base has a /home directory. When the system tries to copy the config from floppy it will fail because of the already existing /home directory.&lt;br /&gt;
&lt;br /&gt;
Make sure the links are stored to floppy:&lt;br /&gt;
 lbu include /home/*&lt;br /&gt;
&lt;br /&gt;
Also remember to move any newly created users to /var/home and create a link:&lt;br /&gt;
 adduser bob&lt;br /&gt;
 mv /home/bob /var/home/&lt;br /&gt;
 ln -s /var/home/bob /home/bob&lt;br /&gt;
 lbu include /home/bob&lt;br /&gt;
&lt;br /&gt;
Save to floppy:&lt;br /&gt;
 lbu commit floppy&lt;br /&gt;
&lt;br /&gt;
== Operational Test ==&lt;br /&gt;
Reboot computer. Now the raid should start and /var should be mounted. Check with df:&lt;br /&gt;
 ~ $ df&lt;br /&gt;
 Filesystem           1k-blocks      Used Available Use% Mounted on&lt;br /&gt;
 none                    255172     23976    231196   9% /&lt;br /&gt;
 mdev                       100         0       100   0% /dev&lt;br /&gt;
 /dev/cdrom              140932    140932         0 100% /media/cdrom&lt;br /&gt;
 /dev/md1              37977060    180984  35866948   1% /var&lt;br /&gt;
&lt;br /&gt;
== Upgrades ==&lt;br /&gt;
Since the package database is on disk, you cannot update by simply replacing the CDROM. You will have to either run the upgrade on the new CDROM or run &#039;&#039;apk_add -u ... &amp;amp;&amp;amp; update-conf&#039;&#039; manually.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Setting up swap ==&lt;br /&gt;
&lt;br /&gt;
# create a partition with the type set to &amp;quot;linux swap&amp;quot; (82) (If you&#039;re going to use a logical volume for swap, skip this step and &amp;lt;code&amp;gt;lvcreate&amp;lt;/code&amp;gt; that instead.)&lt;br /&gt;
# &amp;lt;code&amp;gt;mkswap /dev/sda2&amp;lt;/code&amp;gt;&lt;br /&gt;
# &amp;lt;code&amp;gt;echo -e &amp;quot;/dev/sda2 none swap sw 0 0&amp;quot; &amp;gt;&amp;gt; /mnt/etc/fstab&amp;lt;/code&amp;gt;&lt;br /&gt;
# &amp;lt;code&amp;gt;swapon /dev/sda2&amp;lt;/code&amp;gt; (or &amp;lt;code&amp;gt;rc-service swap start&amp;lt;/code&amp;gt;)&lt;br /&gt;
&lt;br /&gt;
{{Cmd|free -m}} will show how much swap space is available (in MB).&lt;br /&gt;
&lt;br /&gt;
If you prefer maximum speed, you don&#039;t need configure any raid devices for swap. Just add 2 swap partitions on different disks and linux will stripe them automatically. The downside is that the moment one disk fails, the system will go down. For better reliability, put swap on RAID1. &lt;br /&gt;
&lt;br /&gt;
{{Todo|Instructions for cryptswap?}}&lt;br /&gt;
&lt;br /&gt;
== Custom boot partition size ==&lt;br /&gt;
&lt;br /&gt;
The default boot partition size is under 40MB. This can cause errors if package updates require additional space on /boot.&lt;br /&gt;
Executing &amp;lt;code&amp;gt;export BOOT_SIZE=512&amp;lt;/code&amp;gt; before running &amp;lt;code&amp;gt;setup-disk&amp;lt;/code&amp;gt; will result in a 512MB boot partition.&lt;br /&gt;
&lt;br /&gt;
[[Category:Installation]]&lt;br /&gt;
[[Category:Storage]]&lt;/div&gt;</summary>
		<author><name>Leonclx</name></author>
	</entry>
</feed>