Subject: [alpine-devel] Change root partition question

From: "Luca Bianchi" <[email-masked]>
Date: Fri, 24 May 2013 13:15:25 +0200

Hi 
I'm playing with alpine 2.4.5 on XCP and try to change the root partion
of default installation

This is the default device where I have installed alpine

alpine:~# fdisk -l /dev/xvda

Disk /dev/xvda: 25.7 GB, 25769803776 bytes
255 heads, 63 sectors/track, 3133 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

    Device Boot      Start         End      Blocks  Id System
/dev/xvda1   *           1          13      102399+ 83 Linux
Partition 1 does not end on cylinder boundary
/dev/xvda2              13         267     2036736  82 Linux swap
Partition 2 does not end on cylinder boundary
/dev/xvda3             267        3134    23026688  83 Linux

Then I have added a new device , format the partition and coping all
files from / partition

alpine:~# fdisk -l /dev/xvdb

Disk /dev/xvdb: 4294 MB, 4294967296 bytes
255 heads, 63 sectors/track, 522 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

    Device Boot      Start         End      Blocks  Id System
/dev/xvdb1               1         522     4192933+ 83 Linux

This Is the UUID list

alpine:~# blkid
/dev/xvdb1: UUID="4bb19343-c06c-42f1-8181-c8b45dab18df" TYPE="ext4"
-----> the  new /  partition
/dev/xvda1: UUID="cde4c3b5-86cc-4ccd-93f4-2495d6c67e5f" TYPE="ext4" 
/dev/xvda2: UUID="ceec35d0-56a8-4e33-a348-34a1e3ac25a6" TYPE="swap" 
/dev/xvda3: UUID="ab8e47dd-53ce-4515-b5dc-72a9ebab58fa" TYPE="ext4" 

I have change the fstab file

alpine:~# cat /etc/fstab
UUID=ab8e47dd-53ce-4515-b5dc-72a9ebab58fa       /oldroot        ext4
rw,relatime,nobarrier,data=ordered 0 0
UUID=4bb19343-c06c-42f1-8181-c8b45dab18df       /               ext4
rw,relatime,nobarrier,data=ordered 0 0
UUID=cde4c3b5-86cc-4ccd-93f4-2495d6c67e5f       /boot           ext4
rw,relatime,nobarrier,data=ordered 0 0
UUID=ceec35d0-56a8-4e33-a348-34a1e3ac25a6       swap            swap
default 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

And added nobarrier option in fs mount to crosschek the new fs mount
after the boot

When I reboot I got this 

alpine:~# df -k
Filesystem           1K-blocks      Used Available Use% Mounted on
mdev                      1024         4      1020   0% /dev
shm                     509280         0    509280   0% /dev/shm
/dev/xvda3            22664700    485956  21027412   2% /
------------> old / partition
tmpfs                   509280       260    509020   0% /run
cgroup_root              10240         0     10240   0% /sys/fs/cgroup
/dev/xvda3            22664700    485956  21027412   2% /oldroot
-------------> same as /
/dev/xvda1               99146     16139     77888  17% /boot

/ is always mounted on old device /dev/xvd3  , the /dev/xvdb1 is no show

If i list mount option see / and /oldroot are mounted without the
nobarrier option , so seem that the fstab file is ignored when
system mount / partition

alpine:~# mount
rootfs on / type rootfs (rw)
proc on /proc type proc (rw,nosuid,nodev,noexec,relatime)
sysfs on /sys type sysfs (rw,nosuid,nodev,noexec,relatime)
mdev on /dev type tmpfs (rw,nosuid,relatime,size=1024k,mode=755)
devpts on /dev/pts type devpts
(rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=000)
shm on /dev/shm type tmpfs (rw,nosuid,nodev,noexec,relatime)
/dev/xvda3 on / type ext4 (rw,relatime,data=ordered)
tmpfs on /run type tmpfs (rw,nosuid,nodev,relatime,mode=755)
securityfs on /sys/kernel/security type securityfs
(rw,nosuid,nodev,noexec,relatime)
debugfs on /sys/kernel/debug type debugfs
(rw,nosuid,nodev,noexec,relatime)
cgroup_root on /sys/fs/cgroup type tmpfs
(rw,nosuid,nodev,noexec,relatime,size=10240k,mode=755)
openrc on /sys/fs/cgroup/openrc type cgroup
(rw,nosuid,nodev,noexec,relatime,release_agent=/lib/rc/sh/cgroup-release
-agent.sh,name=openrc)
cpuset on /sys/fs/cgroup/cpuset type cgroup
(rw,nosuid,nodev,noexec,relatime,cpuset)
cpu on /sys/fs/cgroup/cpu type cgroup
(rw,nosuid,nodev,noexec,relatime,cpu)
cpuacct on /sys/fs/cgroup/cpuacct type cgroup
(rw,nosuid,nodev,noexec,relatime,cpuacct)
devices on /sys/fs/cgroup/devices type cgroup
(rw,nosuid,nodev,noexec,relatime,devices)
freezer on /sys/fs/cgroup/freezer type cgroup
(rw,nosuid,nodev,noexec,relatime,freezer)
blkio on /sys/fs/cgroup/blkio type cgroup
(rw,nosuid,nodev,noexec,relatime,blkio)
/dev/xvda3 on /oldroot type ext4 (rw,relatime,data=ordered)
/dev/xvda1 on /boot type ext4 (rw,relatime,nobarrier,data=ordered)