Difference between revisions of "Template:DebianOnLinkStationMini"
From NAS-Central Buffalo - The Linkstation Wiki
Rpinchbeck (Talk | contribs) m (Corrected root password regex) |
(→On Linkstation) |
||
(18 intermediate revisions by 2 users not shown) | |||
Line 112: | Line 112: | ||
* Create RAID devices (/dev/md11, /dev/md13, and /dev/md14) | * Create RAID devices (/dev/md11, /dev/md13, and /dev/md14) | ||
cd /mnt | cd /mnt | ||
− | |||
umount /mnt/md13/boot | umount /mnt/md13/boot | ||
umount /mnt/md13 | umount /mnt/md13 | ||
Line 125: | Line 124: | ||
* Format RAID devices | * Format RAID devices | ||
cd /mnt | cd /mnt | ||
− | |||
umount /mnt/md13/boot | umount /mnt/md13/boot | ||
umount /mnt/md13 | umount /mnt/md13 | ||
Line 134: | Line 132: | ||
* Mount RAID devices and create required directories | * Mount RAID devices and create required directories | ||
− | |||
− | |||
mkdir -p /mnt/md13 | mkdir -p /mnt/md13 | ||
mount /dev/md13 /mnt/md13 | mount /dev/md13 /mnt/md13 | ||
Line 152: | Line 148: | ||
rm -f /mnt/md13/boot/boot | rm -f /mnt/md13/boot/boot | ||
− | * Install kernel (uImage.buffalo) | + | * Install 2.6.27 kernel (uImage.buffalo) - Tried and tested, but limited modules ( no usb-storage support ) |
cd /mnt/md13 | cd /mnt/md13 | ||
rm -f /mnt/md13/LS-Mini-2.6.27-rc6lsmini-2008-10-09-23-39-29.tbz2 | rm -f /mnt/md13/LS-Mini-2.6.27-rc6lsmini-2008-10-09-23-39-29.tbz2 | ||
wget http://buffalo.nas-central.org/download/LSMini_ARM9/Distributions/Genlink/Kernel/LS-Mini-2.6.27-rc6lsmini-2008-10-09-23-39-29.tbz2 | wget http://buffalo.nas-central.org/download/LSMini_ARM9/Distributions/Genlink/Kernel/LS-Mini-2.6.27-rc6lsmini-2008-10-09-23-39-29.tbz2 | ||
tar --extract --verbose --same-permissions --bzip2 --file LS-Mini-2.6.27-rc6lsmini-2008-10-09-23-39-29.tbz2 | tar --extract --verbose --same-permissions --bzip2 --file LS-Mini-2.6.27-rc6lsmini-2008-10-09-23-39-29.tbz2 | ||
+ | |||
+ | * Optionally install 2.6.32.2 kernel (uImage.buffalo) - has many more kernel modules | ||
+ | The associated kernel config file can also be found here: http://buffalo.jpfast.net/2.6.32.2/LS-Mini-2.6.32.2-2010-01-06-20-41+0900-config.bz2 | ||
+ | cd /mnt/md13 | ||
+ | rm -f /mnt/md13/LS-Mini-2.6.32.2-2010-01-06-20-41+0900.tgz | ||
+ | wget http://buffalo.jpfast.net/2.6.32.2/LS-Mini-2.6.32.2-2010-01-06-20-41+0900.tgz | ||
+ | tar --extract --verbose --same-permissions --gzip --file LS-Mini-2.6.32.2-2010-01-06-20-41+0900.tgz | ||
* Install initrd (initrd.buffalo) | * Install initrd (initrd.buffalo) | ||
Line 169: | Line 172: | ||
* Configure Gentoo fstab (file system table - mount points) | * Configure Gentoo fstab (file system table - mount points) | ||
rm -f /mnt/md13/etc/fstab | rm -f /mnt/md13/etc/fstab | ||
− | echo "/dev/sda2 none swap sw,pri=1 | + | echo "/dev/sda2 none swap sw,pri=1 0 0" >>/mnt/md13/etc/fstab |
− | echo "/dev/sdb2 none swap sw,pri=2 | + | echo "/dev/sdb2 none swap sw,pri=2 0 0" >>/mnt/md13/etc/fstab |
− | echo "/dev/md13 / ext3 | + | echo "/dev/md13 / ext3 noatime,errors=remount-ro 0 1" >>/mnt/md13/etc/fstab |
− | echo "/dev/md11 /boot ext3 | + | echo "/dev/md11 /boot ext3 noatime,errors=remount-ro 0 0" >>/mnt/md13/etc/fstab |
− | echo "/dev/md14 /srv ext3 | + | echo "/dev/md14 /srv ext3 noatime,errors=remount-ro 0 0" >>/mnt/md13/etc/fstab |
− | echo "shm /dev/shm tmpfs nodev,nosuid,noexec | + | echo "shm /dev/shm tmpfs noatime,nodev,nosuid,noexec 0 0" >>/mnt/md13/etc/fstab |
− | echo "tmpfs /tmp tmpfs | + | echo "tmpfs /tmp tmpfs noatime,nodev,nosuid,noexec 0 0" >>/mnt/md13/etc/fstab |
* Install debootstrap package (for downloading {{{distro}}} bootstrap files) | * Install debootstrap package (for downloading {{{distro}}} bootstrap files) | ||
Line 202: | Line 205: | ||
* Unmount RAID devices | * Unmount RAID devices | ||
cd /mnt | cd /mnt | ||
− | |||
umount /mnt/md13/boot | umount /mnt/md13/boot | ||
umount /mnt/md13 | umount /mnt/md13 | ||
Line 228: | Line 230: | ||
* Complete bootstrapping process | * Complete bootstrapping process | ||
− | chroot / | + | mkdir -p /mnt/md14 |
+ | mount /dev/md14 /mnt/md14 | ||
+ | chroot /mnt/md14/bootstrap /debootstrap/debootstrap --second-stage | ||
sync | sync | ||
Line 265: | Line 269: | ||
* Create RAID devices | * Create RAID devices | ||
cd /mnt | cd /mnt | ||
− | |||
umount /mnt/md13 | umount /mnt/md13 | ||
umount /mnt/md14 | umount /mnt/md14 | ||
Line 339: | Line 342: | ||
echo "ALL : 127.0.0.1" >>/mnt/md13/etc/hosts.allow | echo "ALL : 127.0.0.1" >>/mnt/md13/etc/hosts.allow | ||
− | * Configure fstab (file system table) | + | * Configure fstab (file system table) '''Important: do not change the last column for on RAID (md) devices, any other values will prevent the device from initializing!''' |
rm -f /mnt/md13/etc/fstab | rm -f /mnt/md13/etc/fstab | ||
− | echo "/dev/sda2 none swap sw,pri=1 | + | echo "/dev/sda2 none swap sw,pri=1 0 0" >>/mnt/md13/etc/fstab |
− | echo "/dev/sdb2 none swap sw,pri=2 | + | echo "/dev/sdb2 none swap sw,pri=2 0 0" >>/mnt/md13/etc/fstab |
− | echo "/dev/md13 / ext3 | + | echo "/dev/md13 / ext3 noatime,errors=remount-ro 0 1" >>/mnt/md13/etc/fstab |
− | echo "/dev/md11 /boot ext3 | + | echo "/dev/md11 /boot ext3 noatime,errors=remount-ro 0 0" >>/mnt/md13/etc/fstab |
− | echo "/dev/md14 /srv ext3 | + | echo "/dev/md14 /srv ext3 noatime,errors=remount-ro 0 0" >>/mnt/md13/etc/fstab |
− | echo "shm /dev/shm tmpfs nodev,nosuid,noexec | + | echo "shm /dev/shm tmpfs noatime,nodev,nosuid,noexec 0 0" >>/mnt/md13/etc/fstab |
− | echo "tmpfs /tmp tmpfs | + | echo "tmpfs /tmp tmpfs noatime,nodev,nosuid,noexec 0 0" >>/mnt/md13/etc/fstab |
* Configure resolve.conf | * Configure resolve.conf | ||
Line 354: | Line 357: | ||
* Configure sources.list | * Configure sources.list | ||
rm -f /mnt/md13/etc/apt/sources.list | rm -f /mnt/md13/etc/apt/sources.list | ||
− | echo "deb {{{source}}} {{{release}}} main {{{contrib}}}" >>/mnt/md13/etc/apt/sources.list | + | {{#ifeq: {{{distro}}} | Ubuntu | echo "deb {{{source}}} {{{release}}} main {{{contrib}}}" >>/mnt/md13/etc/apt/sources.list }} |
− | echo "deb-src {{{source}}} {{{release}}} main {{{contrib}}}" >>/mnt/md13/etc/apt/sources.list | + | {{#ifeq: {{{distro}}} | Ubuntu | echo "deb-src {{{source}}} {{{release}}} main {{{contrib}}}" >>/mnt/md13/etc/apt/sources.list }} |
− | echo "deb {{{source}}} {{{release}}}-security main {{{contrib}}}" >>/mnt/md13/etc/apt/sources.list | + | {{#ifeq: {{{distro}}} | Ubuntu | echo "deb {{{source}}} {{{release}}}-security main {{{contrib}}}" >>/mnt/md13/etc/apt/sources.list | }} |
− | echo "deb-src {{{source}}} {{{release}}}-security main {{{contrib}}}" >>/mnt/md13/etc/apt/sources.list | + | {{#ifeq: {{{distro}}} | Ubuntu | echo "deb-src {{{source}}} {{{release}}}-security main {{{contrib}}}" >>/mnt/md13/etc/apt/sources.list | }} |
− | echo "deb {{{source}}} {{{release}}}-updates main {{{contrib}}}" >>/mnt/md13/etc/apt/sources.list | + | {{#ifeq: {{{distro}}} | Ubuntu | echo "deb {{{source}}} {{{release}}}-updates main {{{contrib}}}" >>/mnt/md13/etc/apt/sources.list | }} |
− | echo "deb-src {{{source}}} {{{release}}}-updates main {{{contrib}}}" >>/mnt/md13/etc/apt/sources.list | + | {{#ifeq: {{{distro}}} | Ubuntu | echo "deb-src {{{source}}} {{{release}}}-updates main {{{contrib}}}" >>/mnt/md13/etc/apt/sources.list | }} |
+ | {{#ifeq: {{{distro}}} | Debian | echo "deb http://ftp.debian.org {{{release}}} main {{{contrib}}}" >>/mnt/md13/etc/apt/sources.list | }} | ||
+ | {{#ifeq: {{{distro}}} | Debian | echo "deb-src http://ftp.debian.org {{{release}}} main {{{contrib}}}" >>/mnt/md13/etc/apt/sources.list | }} | ||
+ | {{#ifeq: {{{distro}}} | Debian | echo "deb http://security.debian.org {{{release}}}/updates main {{{contrib}}}" >>/mnt/md13/etc/apt/sources.list | }} | ||
+ | {{#ifeq: {{{distro}}} | Debian | echo "deb-src http://security.debian.org {{{release}}}/updates main {{{contrib}}}" >>/mnt/md13/etc/apt/sources.list | }} | ||
+ | |||
* Change root password (new password = lsmini) | * Change root password (new password = lsmini) | ||
export SED_FILE='/mnt/md13/etc/shadow' | export SED_FILE='/mnt/md13/etc/shadow' | ||
− | export SED_SEARCH='^\s*root\: | + | export SED_SEARCH='^\s*root\:\*?\:' |
export SED_REPLACE='root:$6$bmlbpJYn$xAgZr6KxoRLjDcPZNDBcnMF52gZrU7xkib43LhSlAvzVS4OqmiHaxB0GInPtoaPQ2FguHQQuxM95cMfvUnYn31:' | export SED_REPLACE='root:$6$bmlbpJYn$xAgZr6KxoRLjDcPZNDBcnMF52gZrU7xkib43LhSlAvzVS4OqmiHaxB0GInPtoaPQ2FguHQQuxM95cMfvUnYn31:' | ||
sed --regexp-extended --expression="s/${SED_SEARCH}/${SED_REPLACE}/" --in-place ${SED_FILE} | sed --regexp-extended --expression="s/${SED_SEARCH}/${SED_REPLACE}/" --in-place ${SED_FILE} |
Latest revision as of 11:12, 7 August 2010
[[Category:{{{distro}}}]]
Install {{{distro}}} {{{version}}} ({{{codename}}}) on Buffalo LinkStation Mini
![]() |
Prerequisites
- Buffalo LinkStation Mini (this process worked on model LS-WS1.0TGL/R1, but other models should work as well)
- Computer with SATA drive interface and internet capability which can also boot a CD-ROM (most modern computers meet this requirement)
- Ubuntu 9.04 Desktop Edition CD-ROM (download and burn from http://releases.ubuntu.com/jaunty/ubuntu-9.04-desktop-i386.iso)
Overview
- First Phase
- Remove the hard drives from the LinkStation and connect them to the SATA interface of a PC.
- Use a live CD-ROM of Ubuntu to partition and format the hard drives, install Gentoo, and prepare the {{{distro}}} bootstrap files.
- Second Phase
- Reassemble the LinkStation, boot it, and login as root to complete the {{{distro}}} bootstrapping process.
- Third Phase
- Remove the hard drives from the LinkStation (again) and connect them to the SATA interface of a PC.
- Use a live CD-ROM of Ubuntu to remove Gentoo and install Ubuntu from the completed bootstrapping process.
- Fourth Phase
- Reassemble the LinkStation and boot into a fresh {{{distro}}} system.
- Note: Do not attempt to execute these commands as a script. Instead, copy and paste each block of commands into a shell window and monitor the resulting output for errors.
First Phase
On Linkstation
- Move power switch to "off" position
- Disconnect power cable
- Disconnect network cable
- Remove cover (per instructions at Disassemble_the_LS_MINI)
- Use a pen to mark hard drive near ethernet port (this is /dev/sda)
- Remove both hard drives
On Computer
- Shutdown
- Power off
- Attach both hard drives to SATA interface
- Ensure that marked hard drive (/dev/sda) is connected to the first SATA interface
- Ensure that second hard drive (/dev/sdb) is connected to the second SATA interface
- Boot Ubuntu 9.04 Desktop Edition CD-ROM
- Specify language (English)
- Enter live mode ("Try Ubuntu without any change to your computer")
- Open a new terminal window (Applications | Accessories | Terminal)
- Start a new bash shell with root privileges
sudo bash
- The following commands will delete all existing partitions on both hard drives and reconfigure them as follows...
Partition | Mount | Size | Type | Description |
---|---|---|---|---|
1 | boot | 128MB | fd | linux raid autodetect |
2 | swap | 256MB | 82 | linux swap |
3 | root | 12GB | fd | linux raid autodetect |
4 | srv | 100% | fd | linux raid autodetect |
- Remove all existing partitions and repartition both drives
PARTITION1_SIZE=128MB PARTITION2_SIZE=256MB PARTITION3_SIZE=12GB swapoff -a echo -e "d\n1\nd\n2\nd\n3\nd\n4\nn\np\n1\n\n+${PARTITION1_SIZE}\nn\np\n2\n\n+${PARTITION2_SIZE}\nn\np\n3\n\n+${PARTITION3_SIZE}\nn\np\n\n\nt\n1\nfd\nt\n2\n82\nt\n3\nfd\nt\n4\nfd\nw\n" | fdisk /dev/sda echo -e "d\n1\nd\n2\nd\n3\nd\n4\nn\np\n1\n\n+${PARTITION1_SIZE}\nn\np\n2\n\n+${PARTITION2_SIZE}\nn\np\n3\n\n+${PARTITION3_SIZE}\nn\np\n\n\nt\n1\nfd\nt\n2\n82\nt\n3\nfd\nt\n4\nfd\nw\n" | fdisk /dev/sdb
- Activate swap partitions
mkswap /dev/sda2 mkswap /dev/sdb2 swapon /dev/sda2 swapon /dev/sdb2
- Install mdadm package (for administering software raid configuration)
Ignore any "/dev/MAKEDEV not found" failure message -- it is a bug which does not affect this process.
export DEBIAN_FRONTEND=noninteractive apt-get update apt-get -q -y install mdadm unset DEBIAN_FRONTEND
- Create RAID devices (/dev/md11, /dev/md13, and /dev/md14)
cd /mnt umount /mnt/md13/boot umount /mnt/md13 umount /mnt/md14 mdadm --stop /dev/md11 mdadm --stop /dev/md13 mdadm --stop /dev/md14 echo "y" | mdadm --create --verbose /dev/md11 --level=1 --raid-devices=2 /dev/sda1 /dev/sdb1 echo "y" | mdadm --create --verbose /dev/md13 --level=1 --raid-devices=2 /dev/sda3 /dev/sdb3 echo "y" | mdadm --create --verbose /dev/md14 --level=1 --raid-devices=2 /dev/sda4 /dev/sdb4
- Format RAID devices
cd /mnt umount /mnt/md13/boot umount /mnt/md13 umount /mnt/md14 mkfs.ext3 -F /dev/md11 mkfs.ext3 -F /dev/md13 mkfs.ext3 -F /dev/md14
- Mount RAID devices and create required directories
mkdir -p /mnt/md13 mount /dev/md13 /mnt/md13 mkdir -p /mnt/md13/boot mount /dev/md11 /mnt/md13/boot mkdir -p /mnt/md14 mount /dev/md14 /mnt/md14
Do not change the order of the next 3 blocks. The correct order is Gentoo (GenLink), kernel, initrd.
- Install Gentoo root file system (GenLink)
cd /mnt/md13 rm -f /mnt/md13/GenLink-stage3.1_arm9-1.1_rc3-20080923.tar.bz2 wget http://downloads.buffalo.nas-central.org/LSPro_ARM9/Distributions/Genlink/Rootfs/GenLink-stage3.1_arm9-1.1_rc3-20080923.tar.bz2 tar --extract --verbose --same-permissions --bzip2 --file GenLink-stage3.1_arm9-1.1_rc3-20080923.tar.bz2 rm -f /mnt/md13/boot/boot
- Install 2.6.27 kernel (uImage.buffalo) - Tried and tested, but limited modules ( no usb-storage support )
cd /mnt/md13 rm -f /mnt/md13/LS-Mini-2.6.27-rc6lsmini-2008-10-09-23-39-29.tbz2 wget http://buffalo.nas-central.org/download/LSMini_ARM9/Distributions/Genlink/Kernel/LS-Mini-2.6.27-rc6lsmini-2008-10-09-23-39-29.tbz2 tar --extract --verbose --same-permissions --bzip2 --file LS-Mini-2.6.27-rc6lsmini-2008-10-09-23-39-29.tbz2
- Optionally install 2.6.32.2 kernel (uImage.buffalo) - has many more kernel modules
The associated kernel config file can also be found here: http://buffalo.jpfast.net/2.6.32.2/LS-Mini-2.6.32.2-2010-01-06-20-41+0900-config.bz2
cd /mnt/md13 rm -f /mnt/md13/LS-Mini-2.6.32.2-2010-01-06-20-41+0900.tgz wget http://buffalo.jpfast.net/2.6.32.2/LS-Mini-2.6.32.2-2010-01-06-20-41+0900.tgz tar --extract --verbose --same-permissions --gzip --file LS-Mini-2.6.32.2-2010-01-06-20-41+0900.tgz
- Install initrd (initrd.buffalo)
cd /mnt/md13 rm -f /mnt/md13/initrd-md13-armv5tejl-softfloat-1.0.tbz2 wget http://buffalo-nas-hacking.googlecode.com/files/initrd-md13-armv5tejl-softfloat-1.0.tbz2 tar --extract --verbose --same-permissions --bzip2 --file initrd-md13-armv5tejl-softfloat-1.0.tbz2
- Configure Gentoo resolv.conf
cp /etc/resolv.conf /mnt/md13/etc/resolv.conf
- Configure Gentoo fstab (file system table - mount points)
rm -f /mnt/md13/etc/fstab echo "/dev/sda2 none swap sw,pri=1 0 0" >>/mnt/md13/etc/fstab echo "/dev/sdb2 none swap sw,pri=2 0 0" >>/mnt/md13/etc/fstab echo "/dev/md13 / ext3 noatime,errors=remount-ro 0 1" >>/mnt/md13/etc/fstab echo "/dev/md11 /boot ext3 noatime,errors=remount-ro 0 0" >>/mnt/md13/etc/fstab echo "/dev/md14 /srv ext3 noatime,errors=remount-ro 0 0" >>/mnt/md13/etc/fstab echo "shm /dev/shm tmpfs noatime,nodev,nosuid,noexec 0 0" >>/mnt/md13/etc/fstab echo "tmpfs /tmp tmpfs noatime,nodev,nosuid,noexec 0 0" >>/mnt/md13/etc/fstab
- Install debootstrap package (for downloading {{{distro}}} bootstrap files)
cd / export DEBIAN_FRONTEND=noninteractive apt-get update apt-get -q -y install debootstrap unset DEBIAN_FRONTEND
- Download {{{distro}}} {{{release}}} ({{{codename}}}) bootstrap files
cd /mnt/md14 rm -rf /mnt/md14/bootstrap mkdir -p /mnt/md14/bootstrap debootstrap --foreign --arch armel --include ssh,ntp {{{release}}} /mnt/md14/bootstrap {{{source}}}
- Wait for RAID synchronization to complete
while egrep -iq '(recovery)|(resync)' /proc/mdstat; do clear cat /proc/mdstat sleep 5 done clear cat /proc/mdstat sync
- Unmount RAID devices
cd /mnt umount /mnt/md13/boot umount /mnt/md13 umount /mnt/md14
- Shutdown
shutdown -h now
- Power off
- Remove hard drives
Second Phase
On Linkstation
- Reassemble (without cover)
- Connect network cable
- Connect power cable
- Move power switch to "on" position
- Wait for 20 minutes for Gentoo to initialize
- Seriously, find something else to do... it takes a really long time
- Use ssh to login as root (password = lspro)
- Set clock to any recent date (prevents error messages about file dates, format=MMDDhhnnYYYY)
export TZ=America/New_York date 022714172010
- Complete bootstrapping process
mkdir -p /mnt/md14 mount /dev/md14 /mnt/md14 chroot /mnt/md14/bootstrap /debootstrap/debootstrap --second-stage sync
- Move power switch to "off" position
- Shutdown
shutdown -h now
- Disconnect power cable
- Disconnect network cable
- Remove hard drives
Third Phase
On Computer
- Shutdown
- Power off
- Attach both hard drives to SATA interface
- Ensure that marked hard drive (/dev/sda) is connected to the first SATA interface
- Ensure that second hard drive (/dev/sdb) is connected to the second SATA interface
- Boot Ubuntu 9.04 Desktop Edition CD-ROM
- Specify language (English)
- Enter live mode ("Try Ubuntu without any change to your computer")
- Open a new terminal window (Applications | Accessories | Terminal)
- Start a new bash shell with root privileges
sudo bash
- Install mdadm package (for administering software RAID configuration)
Ignore any "/dev/MAKEDEV not found" failure message -- it is a bug which does not affect this process.
export DEBIAN_FRONTEND=noninteractive apt-get update apt-get -q -y install mdadm unset DEBIAN_FRONTEND
- Create RAID devices
cd /mnt umount /mnt/md13 umount /mnt/md14 mdadm --stop /dev/md11 mdadm --stop /dev/md13 mdadm --stop /dev/md14 echo "y" | mdadm --create --verbose /dev/md11 --level=1 --raid-devices=2 /dev/sda1 /dev/sdb1 echo "y" | mdadm --create --verbose /dev/md13 --level=1 --raid-devices=2 /dev/sda3 /dev/sdb3 echo "y" | mdadm --create --verbose /dev/md14 --level=1 --raid-devices=2 /dev/sda4 /dev/sdb4
- Mount RAID devices
mkdir -p /mnt/md11 mount /dev/md11 /mnt/md11 mkdir -p /mnt/md13 mount /dev/md13 /mnt/md13 mkdir -p /mnt/md14 mount /dev/md14 /mnt/md14
- Create archive of existing kernel modules
cd /mnt/md13/lib/modules rm -f /mnt/md14/kernel-modules.tar.bz2 tar --create --verbose --preserve-permissions --bzip2 --file /mnt/md14/kernel-modules.tar.bz2 .
- Create archive of bootstrap files
cd /mnt/md14/bootstrap rm -f /mnt/md14/bootstrap-stage2-lsmini.tar.bz2 tar --create --verbose --preserve-permissions --bzip2 --file /mnt/md14/bootstrap-stage2-lsmini.tar.bz2 .
- Remove existing Gentoo installation
cd /mnt/md13 rm -rf /mnt/md13/*
- Create root file system from archive of bootstrap files
cd /mnt/md13 tar --extract --verbose --same-permissions --bzip2 --file /mnt/md14/bootstrap-stage2-lsmini*.tar.bz2
- Restore kernel modules from archive
cd /mnt/md13/lib/modules mkdir -p /mnt/md13/lib/modules tar --extract --verbose --same-permissions --bzip2 --file /mnt/md14/kernel-modules.tar.bz2
- Prepare host settings (adjust host name and static ip as needed)
export HOST_NAME=lsmini export HOST_ADDRESS=192.168.1.77 export HOST_NETMASK=255.255.0.0 export HOST_GATEWAY=192.168.1.1 export HOST_NETWORK=192.168.1.0
- Configure interfaces
rm -f /mnt/md13/etc/network/interfaces echo "# Used by ifup(8) and ifdown(8). See the interfaces(5) manpage or" >>/mnt/md13/etc/network/interfaces echo "# /usr/share/doc/ifupdown/examples for more information." >>/mnt/md13/etc/network/interfaces echo "#" >>/mnt/md13/etc/network/interfaces echo "auto lo eth0" >>/mnt/md13/etc/network/interfaces echo "iface lo inet loopback" >>/mnt/md13/etc/network/interfaces echo "iface eth0 inet static" >>/mnt/md13/etc/network/interfaces echo " address ${HOST_ADDRESS}" >>/mnt/md13/etc/network/interfaces echo " netmask ${HOST_NETMASK}" >>/mnt/md13/etc/network/interfaces echo " gateway ${HOST_GATEWAY}" >>/mnt/md13/etc/network/interfaces
- Configure hostname
rm -f /mnt/md13/etc/hostname echo "${HOST_NAME}" >>/mnt/md13/etc/hostname
- Configure hosts
rm -f /mnt/md13/etc/hosts echo "127.0.0.1 localhost" >>/mnt/md13/etc/hosts echo "${HOST_ADDRESS} ${HOST_NAME}" >>/mnt/md13/etc/hosts
- Configure hosts.allow
rm -f /mnt/md13/etc/hosts.allow echo "ALL : ${HOST_NETWORK}/${HOST_NETMASK}" >>/mnt/md13/etc/hosts.allow echo "ALL : 127.0.0.1" >>/mnt/md13/etc/hosts.allow
- Configure fstab (file system table) Important: do not change the last column for on RAID (md) devices, any other values will prevent the device from initializing!
rm -f /mnt/md13/etc/fstab echo "/dev/sda2 none swap sw,pri=1 0 0" >>/mnt/md13/etc/fstab echo "/dev/sdb2 none swap sw,pri=2 0 0" >>/mnt/md13/etc/fstab echo "/dev/md13 / ext3 noatime,errors=remount-ro 0 1" >>/mnt/md13/etc/fstab echo "/dev/md11 /boot ext3 noatime,errors=remount-ro 0 0" >>/mnt/md13/etc/fstab echo "/dev/md14 /srv ext3 noatime,errors=remount-ro 0 0" >>/mnt/md13/etc/fstab echo "shm /dev/shm tmpfs noatime,nodev,nosuid,noexec 0 0" >>/mnt/md13/etc/fstab echo "tmpfs /tmp tmpfs noatime,nodev,nosuid,noexec 0 0" >>/mnt/md13/etc/fstab
- Configure resolve.conf
cp --archive /etc/resolv.conf /mnt/md13/etc/resolv.conf
- Configure sources.list
rm -f /mnt/md13/etc/apt/sources.list
- Change root password (new password = lsmini)
export SED_FILE='/mnt/md13/etc/shadow' export SED_SEARCH='^\s*root\:\*?\:' export SED_REPLACE='root:$6$bmlbpJYn$xAgZr6KxoRLjDcPZNDBcnMF52gZrU7xkib43LhSlAvzVS4OqmiHaxB0GInPtoaPQ2FguHQQuxM95cMfvUnYn31:' sed --regexp-extended --expression="s/${SED_SEARCH}/${SED_REPLACE}/" --in-place ${SED_FILE}
- Create archive of root file system
cd /mnt/md13 rm -f /mnt/md14/rootfs-lsmini.tar.bz2 tar --create --verbose --preserve-permissions --bzip2 --file /mnt/md14/rootfs-lsmini.tar.bz2 .
- Remove bootstrap files
cd /mnt/md14 rm -rf /mnt/md14/bootstrap
- Wait for RAID synchronization to complete
while egrep -iq '(recovery)|(resync)' /proc/mdstat; do clear cat /proc/mdstat sleep 5 done clear cat /proc/mdstat sync
- Sync and unmount RAID devices
cd /mnt sync umount /mnt/md11 umount /mnt/md13 umount /mnt/md14
- Shutdown
shutdown -h now
- Power off
- Remove hard drives
Fourth Phase
On LinkStation
- Reassemble
- Connect network cable
- Connect power cable
- Move power switch to "on" position
- Wait for 15 minutes for initialization to complete (later reboots will be ready much faster)
- Login with ssh as root (password = lsmini)
- Configure default system locale (adjust LANG variable to suit your needs, format = language_COUNTRY.ENCODING)
export LANG=en_US.UTF-8 locale-gen ${LANG} update-locale LANG="${LANG}"
- Select timezone
dpkg-reconfigure tzdata
- Ensure that date and time are correct
date
- Change root password to something hard to guess
passwd root
- Install mdadm package (ignore MAKEDEV not found failed message)
export DEBIAN_FRONTEND=noninteractive apt-get update apt-get -q -y install mdadm unset DEBIAN_FRONTEND
- Add /dev/sdb partitions to RAID devices (/dev/sdb is intentional-- the device names get switched somehow)
mdadm --add /dev/md11 /dev/sdb1 mdadm --add /dev/md13 /dev/sdb3 mdadm --add /dev/md14 /dev/sdb4
- Add user (never login as root, use sudo command instead)
export USER_NAME=visitor adduser ${USER_NAME}
See Also