View Single Post
Old 19-02-2011, 21:34   #4449
mrgima
Senior Member
 
Iscritto dal: Oct 2002
Messaggi: 480
Sto installando l'ultimo firmware di coatto da zero su extroot. Ne ho approfittato per scrivere tutti i passi che sto effettuando, in modo che possa essere utile per qualcuno.

Utilizzo di extroot per spostare il firmware su storage esterno

1. Ho installato la build tramite tftp

2. Sono entrato via telnet, ho settato la password col comando passwd e ho riavviato col comando reboot

3. Ho configurato il wireless e ho riavviato

4. Da Servizi -> initscripts ho disattivato l’avvio automatico dei seguenti servizi:
a. Avahi-daemon
b. Hd-idle
c. Minidlna
d. P910nd
e. Qos
f. Radvd
g. Etherwake
h. Nfsd
i. Samba
j. Miniupnpd
k. Gw6c
l. Transmission

forse questo punto 4 non serve perché dopo aver fatto extroot mi sono ritrovato tutti i servizi abilitati di nuovo come al primo avvio! non so perché...

5. Reboot e verifica che sia tutto ok

6. Modificato il file fstab per montare lo storage esterno (nel mio caso, una penna usb /dev/sda1 per il sistema operativo ed un hd esterno /dev/sdb1 per lo storage):
Codice:
config global automount
	option from_fstab 1
	option anon_mount 1
	
config global autoswap
	option from_fstab 1
	option anon_swap 0
	
config mount
	option target	/mnt/sda1
	option device	/dev/sda1
	option fstype	ext4   
	option options	rw,async,noatime
	option enabled	1
	option enabled_fsck 0
	
config mount
	option target	/mnt/sdb1
	option device	/dev/sdb1
	option fstype	ext4   
	option options	rw,async,noatime
	option enabled	1
	option enabled_fsck 0

config swap
	option device	/dev/sda2
	option enabled	0
Verifica che sia tutto ok:

Codice:
 root@OpenWrt:~# df -h
Filesystem                Size      Used Available Use% Mounted on
/dev/root                 6.1M      6.1M         0 100% /rom
tmpfs                    30.3M    124.0K     30.2M   0% /tmp
tmpfs                   512.0K         0    512.0K   0% /dev
/dev/mtdblock4          576.0K    244.0K    332.0K  42% /overlay
mini_fo:/overlay          6.1M      6.1M         0 100% /
/dev/sda1                 7.4G    144.8M      6.8G   2% /mnt/sda1
/dev/sdb1               984.4G    100.8G    833.6G  11% /mnt/sdb1
root@OpenWrt:~# mount
rootfs on / type rootfs (rw)
/dev/root on /rom type squashfs (ro,relatime)
proc on /proc type proc (rw,relatime)
sysfs on /sys type sysfs (rw,relatime)
tmpfs on /tmp type tmpfs (rw,nosuid,nodev,relatime)
tmpfs on /dev type tmpfs (rw,relatime,size=512k,mode=755)
devpts on /dev/pts type devpts (rw,relatime,mode=600)
/dev/mtdblock4 on /overlay type jffs2 (rw,relatime)
mini_fo:/overlay on / type mini_fo (rw,relatime)
debugfs on /sys/kernel/debug type debugfs (rw,relatime)
/dev/sda1 on /mnt/sda1 type ext4 (rw,noatime,barrier=1,data=ordered)
/dev/sdb1 on /mnt/sdb1 type ext4 (rw,noatime,barrier=1,data=ordered)
none on /proc/bus/usb type usbfs (rw,relatime)
root@OpenWrt:~#
7. Eseguito il comando del post di coatto:
Codice:
 mkdir -p /tmp/bindroot && mount --bind / /tmp/bindroot && tar -C /tmp/bindroot -cf - . | tar -C /mnt/sda1 -xvf - && umount /tmp/bindroot
8. Completata la configurazione di extroot seguendo http://wiki.openwrt.org/doc/howto/extroot e https://forum.openwrt.org/viewtopic.php?id=24138

Nel nuovo fstab, praticamente l'unica modifica è: option is_rootfs 1

Codice:
config global automount
	option from_fstab 1
	option anon_mount 1
	
config global autoswap
	option from_fstab 1
	option anon_swap 0
	
config mount
	option target	/mnt/sda1
	option device	/dev/sda1
	option fstype	ext4   
	option options	rw,async,noatime
	option enabled	1
	option enabled_fsck 0
	option is_rootfs 1
	
config mount
	option target	/mnt/sdb1
	option device	/dev/sdb1
	option fstype	ext4   
	option options	rw,async,noatime
	option enabled	1
	option enabled_fsck 0

config swap
	option device	/dev/sda2
	option enabled	0
9. Reboot e verifica che stia utilizzando il sistema operativo su storage esterno con il comando df –h:
Codice:
 root@OpenWrt:~# df -h
Filesystem                Size      Used Available Use% Mounted on
/dev/root                 6.1M      6.1M         0 100% /rom
tmpfs                    30.3M    364.0K     30.0M   1% /tmp
tmpfs                   512.0K         0    512.0K   0% /dev
/dev/sda1                 7.4G    170.9M      6.8G   2% /overlay
mini_fo:/overlay          6.1M      6.1M         0 100% /
/dev/sdb1               984.4G    100.8G    833.6G  11% /mnt/sdb1
root@OpenWrt:~#


Attivazione del file di swap su storage esterno

1. Modificato il file /sbin/attiva swap sostituendo /overlay a /mnt/
Codice:
 #!/bin/sh
#script per creare un file di swap sull'hard disk usb 
#created by coatto87

echo "Attiva_swap v0.1a per OpenWrt Netgear WNDR3700 by coatto87 <coatto87@gmail.com>"
sleep 1
echo "Controllo che il disco usb sia correttamente montato..."
cat /proc/mounts | grep /dev/sda1 > /dev/null
sleep 1
if [ $? -eq 0 ] ; then
echo "Il disco è montato, procedo a creare un file di swap da 512 megabyte..." 
dd if=/dev/zero of=/overlay/swapfile bs=1024 count=524288
echo "Creato, abilito il file di swap..."
mkswap /overlay/swapfile && swapon /overlay/swapfile
echo "Il file di swap è stato creato in /overlay/swapfile e da ora sarà sempre attivo all'avvio."
echo "Puoi verificarlo digitando il comando free."
else
echo "Il disco usb non è montato correttamente, il file di swap non è stato creato"
fi
2. Eseguito attiva_swap da shell
Codice:
 root@OpenWrt:~# attiva_swap
Attiva_swap v0.1a per OpenWrt Netgear WNDR3700 by coatto87 <coatto87@gmail.com>
Controllo che il disco usb sia correttamente montato...
Il disco è montato, procedo a creare un file di swap da 512 megabyte...
524288+0 records in
524288+0 records out
Creato, abilito il file di swap...
Setting up swapspace version 1, size = 536866816 bytes
UUID=b49aed00-9aaa-4bdd-8588-c7fccf9fad8c
Il file di swap è stato creato in /overlay/swapfile e da ora sarà sempre attivo all'avvio.
Puoi verificarlo digitando il comando free.
root@OpenWrt:~# free
              total         used         free       shared      buffers
  Mem:        62072        60468         1604            0          680
 Swap:       524280            0       524280
Total:       586352        60468       525884
root@OpenWrt:~#
3. Modificato il file rc.local:
Codice:
 # Put your custom commands here that should be executed once
# the system init finished. By default this file does nothing.

test -f /overlay/swapfile && swapon /overlay/swapfile

exit 0


Transmission

E' bastato modificare alcune righe del file /etc/config/transmission:
Codice:
option config_dir '/overlay/transmission'
option download_dir '/overlay/Downloads'
option incomplete_dir '/overlay/Downloads/incomplete'
option incomplete_dir_enabled true

Samba

Ho utilizzato LUCI nella sezione Servizi -> Network Shares -> Shared Directories



NFS

Ipotizzando di voler condividere la directory /overlay/share, va modificato il file etc/exports in questo modo:
Codice:
/overlay/share	*(rw,all_squash,no_subtree_check,insecure,async)

Ultima modifica di mrgima : 20-02-2011 alle 11:32. Motivo: Sistemato lo swap e aggiunto transmission.
mrgima è offline   Rispondi citando il messaggio o parte di esso