[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Change root partition

Hi all, 

how do I change the root partition in my qnap ts-209? I assume I have to 
create a new image and copy it to the flash, right?

Just for the background: I've installed debian on my qnap (btw: thank you for 
the good work!) and some time later I've added a second hard disk. So I've 
converted all partitions into raid1 devices - except the root device 
(dev/sda2) which is always in use after boot. All references to /dev/sda2 are 
removed from /etc/fstab. (Don't know if its a 'good' installation, but I'm 
very lazy and for me it was the easiest way to turn the system into a raid1.)

After booting / is mounted on my new root partition, but a lot of processes 
are already running which reference to the old root partition. Looks like the 
switch of the root partition happens to late during system startup. 

Some details from my config: 

nas:~# mount
/dev/md1 on / type ext3 (rw,errors=remount-ro)
tmpfs on /lib/init/rw type tmpfs (rw,nosuid,mode=0755)
proc on /proc type proc (rw,noexec,nosuid,nodev)
sysfs on /sys type sysfs (rw,noexec,nosuid,nodev)
udev on /dev type tmpfs (rw,mode=0755)
tmpfs on /dev/shm type tmpfs (rw,nosuid,nodev)
devpts on /dev/pts type devpts (rw,noexec,nosuid,gid=5,mode=620)
/dev/md0 on /boot type ext2 (rw)
/dev/md5 on /home type ext3 (rw)
/dev/md4 on /tmp type ext3 (rw)
/dev/md2 on /usr type ext3 (rw)
/dev/md3 on /var type ext3 (rw)
nfsd on /proc/fs/nfsd type nfsd (rw)
nas:~# cat /etc/fstab
# /etc/fstab: static file system information.
# <file system> <mount point>   <type>  <options>       <dump>  <pass>
proc            /proc           proc    defaults        0       0
/dev/md1        /               ext3    errors=remount-ro 0       1
/dev/md0       /boot           ext2    defaults        0       2
/dev/md5       /home           ext3    defaults        0       2
/dev/md4       /tmp            ext3    defaults        0       2
/dev/md2       /usr            ext3    defaults        0       2
/dev/md3       /var            ext3    defaults        0       2
/dev/sda7       none            swap    sw              0       0
/dev/sdb7       none            swap    sw              0       0

nas:~# mdadm --add /dev/md1 /dev/sda2
mdadm: Cannot open /dev/sda2: Device or resource busy

nas:~# cat /proc/mdstat
Personalities : [linear] [multipath] [raid0] [raid1] [raid6] [raid5] [raid4] 
md0 : active raid1 sda1[0] sdb1[1]
      248896 blocks [2/2] [UU]

md1 : active (auto-read-only) raid1 sdb2[1]
      273024 blocks [2/1] [_U]

nas:~# fuser -m /dev/sda2
/dev/sda2:               1rce     2rc     3rc     4rc     5rc     6rc    47rc    
52rc    81rc 82rc    83rc    84rc   198rc   199rc   200rc   232rc   300rc   
301rc   304rc   306rc   689rc696rc   706rc   714rc   723rc   733rc   745rc   
749rc   773rc   856rce  1188rc  1443rc  1444rc1445rc  1447rc  1502rce  1522re  
1602rcm  1636rcm  1821rce  1929rcm  1937rm  1955rc  1972rc  1973rc  1974rc  
1975rc  1976rc  1977rc  1978rc  1979rc  1980rc  1981rc  1985rm  1996rcm  
2007rcm  2009rcm  2023rcm  2028rcm  2034rcm  2038rce  2056rcm  2060rcm  
2062rcm  2065rm  2085rm  2099rcm2120rcm  2122rcm  2124rcm  2126rcm  2127rcm  
2140re  2141rcm  2143rce

nas:~# ps -ef |grep 2124
www-data  2124  2099  0 22:22 ?        00:00:00 /usr/sbin/apache2 -k start
root      2170  2143  0 22:45 pts/0    00:00:00 grep 2124

Looks like apache has been started before reading /etc/fstab and switching to 
the new root. Its strange, isn't it?


Reply to: