How to install with custom partitioning (virtualbox) ???

9 posts / 0 new
Last post
#1 Mon, 2015-03-16 22:17
ALPINISTA
  • ALPINISTA's picture
  • Offline
  • Last seen: 1 year 2 months ago
  • Joined: 2015-03-16

Hi,

I tried to follow the wiki, but unfortunately there are some loose ends and I can not interpolate the right way to do it.

I would like to setup alpine with 4 different (virtual) harddisk in a virtualbox like this:

sda1 - root / 
sdb1 - swap
sdc1 - /tmp
sdd1 - /home

How can I do this?

I boot into the alpine-mini-3.1.2-x86_64.iso and create partitions with fdisk and they seem to be ok:

But then I can not mkfs.ext4 because the package is not installed. I try to install e2fsprog, but I get this error:

ERROR: unsatisfiable constraints:
    e2fsprog (missing):
        required by: world[e2fsprog]

I do not understand http://wiki.alpinelinux.org/wiki/Setting_up_disks_manually#Custom_partitioning - how exactly should I mount the partitions below / to get the result described above? Also the mount command does not work like expected here:

localhost:~# mount /dev/sdc1 /mnt/tmp
mount: mounting /dev/sdc1 on /mnt/tmp failed: Invalid argument

Maybe my mount and fdisk knowledge is a little bit rusty, however it is not clear for me how to achieve the setup described above and in which order I have to execute the setup scripts. Should I first setup-alpine? Or first use fdisk and then call setup-disk /mnt and after this call setup-alpine?

What is the right order of commands to get alpine running with a setup like the one described above?

btw, I can not upload images... oh, yes, Drupal, you have to take some additional action to activate image uploading for users, but I do not remember what it was...

Thanks for your attention!
ALPINISTA

Wed, 2015-03-18 19:23
AmatCoder
  • AmatCoder's picture
  • Offline
  • Last seen: 1 year 4 months ago
  • Joined: 2013-10-18

a) You must run setup-alpine before than setup-disk.
b) You need a /boot partition ---edited---
c) If you use ext4, command is

mount -t ext4 /dev/sdc1 /mnt/tmp

make sure that /mnt/{boot,home,tmp} exist.

Wed, 2015-03-18 01:56 (Reply to #2)
ALPINISTA
  • ALPINISTA's picture
  • Offline
  • Last seen: 1 year 2 months ago
  • Joined: 2015-03-16

Thanks for the info, I will try again!

BTW it would be nice to mention in the wiki that setup-alpine must be executed before customizing hd install and that /boot is needed in every case!

have a nice day!

Wed, 2015-03-18 19:17 (Reply to #3)
AmatCoder
  • AmatCoder's picture
  • Offline
  • Last seen: 1 year 4 months ago
  • Joined: 2013-10-18

Sorry, I did not explain myself porperly.
A boot partition is not needed in every case. A root partition is the only needed.

I meant that setup-disk creates a root, boot and swap partitions by default.

Sun, 2015-07-12 02:33
AlpineInterest
  • AlpineInterest's picture
  • Offline
  • Last seen: 2 years 8 months ago
  • Joined: 2015-07-12

You can use tmpfiles.d to make folders at boot time, same on OpenRC as systemd. That's what I would do with /tmp.
https://github.com/OpenRC/openrc/blob/master/init.d/tmpfiles.setup.in

Tue, 2015-09-01 19:54
cxc
  • cxc's picture
  • Offline
  • Last seen: 2 years 7 months ago
  • Joined: 2015-08-31

I had trouble, too. After having read the documentation on custom partitioning, I could not seem to understand how to go about using custom partitioning with the Alpine installation methods. At some point, I stopped trying to work according to the documentation and fell back on what I already know how to do. The following steps document my success in getting custom partitioning to work well on two systems, one bare metal and one VMware Workstation 11, using LVM and EXT4. Maybe these procedures that I used might serve as hints to help you or others.

First, on release 3.2.3, I used setup-alpine, according to the installation instructions; and, I used the lvm and sys options to perform a default installation using an LVM and EXT4. (This creates an EXT4 boot partition on /dev/sda1 and the remainder partitioned for an LVM Physical partition. The LVM volume group has two logical volumes: one for swap and one for the root filesystem.)

My objective was to separate the file systems this way:

/dev/vg/root    /                    ext4
/dev/sda1       /boot                ext4
/dev/vg/swap    swap                 swap
/dev/vg/tmp     /tmp                 ext4
/dev/vg/var     /var                 ext4
/dev/vg/log     /var/log             ext4
/dev/vg/audit   /var/log/audit       ext4
/dev/vg/home    /home                ext4
/dev/vg/srv     /srv                 ext4
/dev/vg/pgsql   /var/lib/postgresql  ext4

To get the partitions the way I wanted them, I rebooted at the end of the installation, and then I booted again from the optical device. The rest of the process is below.

Add the software needed to work with LVM and Linux Extended file systems.

apk add lvm2 e2fsprogs

Activate the volume group and logical volumes.

vgchange -a y vg0 && lvchange -a y vg0

I want to change the volume group name from vg0 to vg:

vgrename vg0 vg

I want to change the logical volume names:

lvrename /dev/vg/lv_root root
lvrename /dev/vg/lv_swap swap

I want to reduce the size of the logical volume, root, to 1 GB:

e2fsck -f /dev/vg/root
resize2fs -p /dev/vg/root 1G
lvreduce -L 1G /dev/vg/root
e2fsck -f /dev/vg/root

I want to create new logical volume for many file systems:

lvcreate -n var -L 1G vg
lvcreate -n log -L 1G vg
lvcreate -n audit -L 512M vg
lvcreate -n tmp -L 2G vg
lvcreate -n srv -L 2G vg
lvcreate -n pgsql -L 2G vg
lvcreate -n home -l 100%FREE vg

I want to use Extended 4 with the "small" target for file systems under 20 GB:

mke2fs -T small -t ext4 -j -L var /dev/vg/var
mke2fs -T small -t ext4 -j -L log /dev/vg/log
mke2fs -T small -t ext4 -j -L audit /dev/vg/audit
mke2fs -T small -t ext4 -j -L tmp /dev/vg/tmp
mke2fs -T small -t ext4 -j -L srv /dev/vg/srv
mke2fs -T small -t ext4 -j -L pgsql /dev/vg/pgsql

I want to use Extended 4 with the default target for file systems over 20 GB:

mke2fs -t ext4 -j -L home /dev/vg/home

I want to describe these devices and file systems in /etc/fstab:

{
	echo "/dev/vg/root    /mnt                    ext4    defaults 1 1"
	echo "/dev/sda1       /mnt/boot               ext2    defaults 1 1"
	echo "/dev/vg/tmp     /mnt/tmp                ext4    defaults 0 0"
	echo "/dev/vg/var     /mnt/var                ext4    defaults 0 0"
	echo "/dev/vg/log     /mnt/var/log            ext4    defaults 0 0"
	echo "/dev/vg/audit   /mnt/var/log/audit      ext4    defaults 0 0"
	echo "/dev/vg/home    /mnt/home               ext4    defaults 0 0"
	echo "/dev/vg/srv     /mnt/srv                ext4    defaults 0 0"
	echo "/dev/vg/pgsql   /mnt/var/lib/postgresql ext4    defaults 0 0"
	echo "/dev/vg/swap    swap                    swap    defaults 0 0"
	echo "/dev/cdrom      /media/cdrom            iso9660 noauto,ro 0 0"
	echo "/dev/usbdisk    /media/usb              vfat    noauto,ro 0 0"
} > /etc/fstab

I want to mount the root file system and make a directory to store the partition for srv:

mount /mnt
mkdir /mnt/srv

I want preserve the files in var and make directories to store the var, log, and audit volumes:

cd /mnt
tar cvfp var.tar var && rm -rf var/*
mount /mnt/var
mkdir /mnt/var/log
mount /mnt/var/log
mkdir /mnt/var/log
mount /mnt/var/log/audit
tar xvf var.tar && rm -f var.tar

I want to make a directory to store the pgsql volume:

mkdir /mnt/var/lib/postgresql

I want to mount the tmp volume to change permissions:

mount /mnt/tmp
chmod 1777 /mnt/tmp

Using vi /mnt/etc/fstab, I want to replace UUIDs with device names, add volumes, and define my options:

/dev/vg/root    /                   ext4    rw,relatime,data=ordered                     0 1
/dev/sda1       /boot               ext4    rw,noatime,data=ordered                      0 1
/dev/vg/swap    swap                swap    defaults                                     0 0
/dev/vg/tmp     /tmp                ext4    rw,relatime,data=ordered,noexec              0 0
/dev/vg/var     /var                ext4    rw,relatime,data=ordered                     0 0
/dev/vg/log     /var/log            ext4    rw,relatime,data=ordered,noexec,nodev,nosuid 0 0
/dev/vg/audit   /var/log/audit      ext4    rw,relatime,data=ordered,noexec,nodev,nosuid 0 0
/dev/vg/home    /home               ext4    rw,relatime,data=ordered,noexec,nodev,nosuid 0 0
/dev/vg/srv     /srv                ext4    rw,relatime,data=ordered,noexec,nodev,nosuid 0 0
/dev/vg/pgsql   /var/lib/postgresql ext4    data=writeback,noatime                       0 0
/dev/cdrom      /media/cdrom        iso9660 noauto,ro                                    0 0
/dev/fd0        /media/floppy       vfat    noauto                                       0 0
/dev/usbdisk    /media/usb          vfat    noauto                                       0 0

The mount options do not apply to every use case, of course. Unmount all file systems mounted under /mnt, and reboot.

Thu, 2015-10-08 14:39
DonAllen
  • DonAllen's picture
  • Offline
  • Last seen: 1 month 1 week ago
  • Joined: 2015-09-30

The manual partition configuration documentation is awful, as is the documentation for setting up a dual-boot configuration (it doesn't even address dual-booting with Windows, a common scenario; it assumes Ubuntu as the 'other' system and it assumes that system provides the boot-loader). I think the Alpine developers need to take a lesson from the OpenBSD project, which puts a lot of effort into documentation. The Alpine documentation is barely usable in some cases, completely useless in others. Clearly some real thought and effort has gone into building this system by smart people, but their work is for naught in many cases if not supported by minimally adequate documentation.

Sun, 2016-01-10 23:10
DrDavid
  • DrDavid's picture
  • Offline
  • Last seen: 2 years 2 months ago
  • Joined: 2016-01-10

Unfortunately I agree with DonAllen, and he expresses the number one reason I don't push forward with many linux / BSD distros. If the documentation is not excellent, experimenting is not facilitated, and progress often founders. The great documentation of OpenBSD and Debian are a large part of the reason they are my top 2 fav distros.

Sun, 2016-01-17 17:58 (Reply to #8)
DonAllen
  • DonAllen's picture
  • Offline
  • Last seen: 1 month 1 week ago
  • Joined: 2015-09-30

@drdavid -- I, too, am a fan of OpenBSD for similar reasons -- the documentation is excellent, the system is rock solid, and I appreciate the attention they pay to security. Linus Torvalds is a smart guy, but I think he's wrong on the question of security. He seems to think of it only in terms of bug-fixing, which is clearly not correct. There are pro-active things that can be done to thwart attacks that are in OpenBSD and the grsecurity kernel. The latter shouldn't be necessary, but it is, because Torvalds gives security short shrift. OpenBSD does have its problems. The performance is not nearly as good as that of Linux, especially on multiprocessor machines, which is almost all of them these days. Their support for peripherals is not nearly as wide as Linux's. If you run the stable version, the packages tend to be old.

On the Alpine front, I'm beginning to doubt how they do QA, in addition to what I've already said about the documentation. Attempts to install 3.3.0 and 3.3.1 ended in failure on a couple of machines that were running the previous version. I've given up trying to use this system -- too many problems.

But if you decide to press ahead, I made some notes about installing with custom partitioning. Here they are:

1. Set up the partitions and create file-systems and swap (mkswap, swapon) with some external tool, such as GParted.
2. Boot the Alpine install disk.
3. Run setup-alpine -q. Note that if you are doing this on a laptop and have wpa-secured wireless, the script does not deal with wireless security. Useless. But you need network access during the install, so do the install with an ethernet cable stuck in the machine and set up that interface.
3. Run the setup scripts that are not run by setup-alpine -q. See http://wiki.alpinelinux.org/wiki/Alpine_setup_scripts
4. Mount the root filesystem on /mnt and create directories for the others. Mount them, too.
5. Run setup-disk /mnt
6. It is a mystery what setup-disk does with the MBR. Sometimes the system is bootable after an Alpine install, sometimes it's not. If you need a good boot-loaders, try GAG. It's very easy to install and works fine. Alpine does consistently lead what is necessary for chain-loading in the PBR of the /boot partition, so GAG will be happy. And GAG will make it easy to setup a multi-boot machine.

/Don Allen

Log in or register to post comments