Skip to content

Instantly share code, notes, and snippets.

@hitxiang
Forked from lorin/preseed-fragment.seed
Last active December 20, 2015 00:09
Show Gist options
  • Save hitxiang/6039912 to your computer and use it in GitHub Desktop.
Save hitxiang/6039912 to your computer and use it in GitHub Desktop.
d-i partman-auto/disk string /dev/sda
# Use LVM for partitioning
d-i partman-auto/method string lvm
# If one of the disks that are going to be automatically partitioned
# contains an old LVM configuration, the user will normally receive a
# warning. Preseed this away
d-i partman-lvm/device_remove_lvm boolean true
# And the same goes for the confirmation to write the lvm partitions.
d-i partman-lvm/confirm boolean true
# Really, please don't prompt me!
d-i partman-lvm/confirm_nooverwrite boolean true
# partitioning
# Physical partitions:
# 1. BIOS boot partition: 1 MB See https://wiki.archlinux.org/index.php/GRUB2#GUID_Partition_Table_.28GPT.29_specific_instructions
# 2. Boot partition: 250 MB
# 2. LVM, with the following logical volumes
# - Root partition: 250 GB (256000 MB), ext4.
# - Swap: 100% of RAM
# - Data partition: remaining space, XFS
d-i partman-auto/expert_recipe string \
boot-root :: \
1 1 1 free method{ biosgrub } . \
250 250 250 ext2 \
$primary{ } $bootable{ } \
method{ format } format{ } \
use_filesystem{ } filesystem{ ext2 } \
mountpoint{ /boot } \
. \
100% 2048 100% linux-swap \
lv_name{ swap } \
method{ swap } format{ } \
$lvmok{ } \
. \
256000 256000 256000 ext4 \
lv_name{ root } \
method{ lvm } format{ } \
use_filesystem{ } filesystem{ ext4 } \
mountpoint{ / } \
$lvmok{ } \
. \
1024 1024 -1 xfs \
lv_name{ data } \
method{ lvm } format{ } \
use_filesystem{ } filesystem{ xfs } \
mountpoint{ /data } \
$lvmok{ } \
.
# This makes partman automatically partition without confirmation, provided
# that you told it what to do using one of the methods above.
d-i partman-partitioning/confirm_write_new_label boolean true
d-i partman/choose_partition select finish
d-i partman/confirm boolean true
d-i partman/confirm_nooverwrite boolean true
======================
d-i partman-auto/expert_recipe string physics-workstation :: \
32 32 32 free \
$gptonly{ } \
$primary{ } \
$bios_boot{ } \
method{ biosgrub } \
. \
1600 1000 1600 linux-swap \
$gptonly{ } \
$primary{ } \
method{ swap } format{ } \
. \
25500 9000 25555 xfs \
$gptonly{ } \
$primary{ } \
method{ format } format{ } \
use_filesystem{ } filesystem{ xfs } \
mountpoint{ / } \
.
and the output:
# gdisk -l /dev/vda
GPT fdisk (gdisk) version 0.8.4
Partition table scan:
MBR: protective
BSD: not present
APM: not present
GPT: present
Found valid GPT with protective MBR; using GPT.
Disk /dev/vda: 335544320 sectors, 160.0 GiB
Logical sector size: 512 bytes
Disk identifier (GUID): 2A256643-D59F-4B71-B796-9137E7241FE9
Partition table holds up to 128 entries
First usable sector is 34, last usable sector is 335544286
Partitions will be aligned on 1-sector boundaries
Total free space is 0 sectors (0 bytes)
Number Start (sector) End (sector) Size Code Name
1 34 62534 30.5 MiB EF02
2 62535 3187535 1.5 GiB 8200
3 3187536 52992223 23.7 GiB 0700
====================
d-i preseed/late_command string echo ';' | sfdisk /dev/sdb ; xfs-format ;
echo '/dev/sdb1 none xfs sw 0 0' >> /target/etc/fstab ;
echo ';' | sfdisk /dev/xvdb ; mke2fs -j -q /dev/xvdb1 ;
mkdir /target/var/build ;
echo '/dev/xvdb1 /var/build ext3 defaults 0 2' >> /target/etc/fstab
==========================
d-i apt-setup/non-free boolean true
d-i apt-setup/contrib boolean true
d-i pkgsel/include string \
    openssh-server build-essential lsof \
    mlocate
d-i pkgsel/upgrade select full-upgrade
d-i preseed/late_command string \
    in-target wget http://debian.orionschools.us/ohs-postpreseed.sh; \
    in-target /bin/bash -x chmod 755 ./ohs-postpreseed.sh; \
    in-target /bin/bash -x ./ohs-postpreseed.sh;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment