DSM-G600, DNS-3xx and NSA-220 Hack Forum

Unfortunately no one can be told what fun_plug is - you have to see it for yourself.

You are not logged in.

Announcement

#1 2015-01-18 16:33:10

thecrow2003
Member
Registered: 2015-01-18
Posts: 6

Question about 320 with Debian

Hi All.
Two days ago i got my second hand 320 from eBay.
It comes with pre-installed Debian , but without hard drives.
Already i have serial connection to device and i can see Debian booting prompt.
Also i have user and password , i can type linux commands.
Question is : what a procedure to add 2 new unformated hard drives and start to work ? How i move OS from ROM to hard drive ( do i need it ?)?
I checked sites but i can`t see any answer (http://jamie.lentin.co.uk/) at every site i see procedure contains fun_plug , i have no web , no ssh , only serial connection.
If You be so pleasant to give me step-by-step guide  .
Thank you.

Offline

 

#2 2015-01-18 20:42:39

Mijzelf
Member / Developer
Registered: 2008-07-05
Posts: 709

Re: Question about 320 with Debian

A step-by-step is hard, as there are several ways to get Debian running on a NAS.
- kernel and rootfs on disk.
- kernel, initramfs and rootfs on disk.
- kernel and initramfs in flash , rootfs on disk.
- kernel and rootfs in flash.
and maybe I'm forgetting an option. To find out which one is active, post a bootlog, and the output of

Code:

cat /proc/partitions
cat /proc/mtd
cat /proc/mounts
df

How i move OS from ROM to hard drive ( do i need it ?)?

Depends. *If* you have a full Debian rootfs in flash, it's rather limited in space. If you only want to run a samba server, and that fits in flash, it's fine. But if you want more, you'll need to place (parts of) the OS on harddisk.
(Actually I surprised to read on your link that a whole Debian system fits in that 128MiB flash.)

Offline

 

#3 2015-01-18 22:22:55

thecrow2003
Member
Registered: 2015-01-18
Posts: 6

Re: Question about 320 with Debian

root@nas:~# cat /proc/partitions
major minor  #blocks  name

  31        0       1024 mtdblock0
  31        1       2048 mtdblock1
  31        2     128000 mtdblock2
   8        0 1953514584 sda
   8       16 1953514584 sdb

root@nas:~# cat /proc/partitions
major minor  #blocks  name

  31        0       1024 mtdblock0
  31        1       2048 mtdblock1
  31        2     128000 mtdblock2
   8        0 1953514584 sda
   8       16 1953514584 sdb
root@nas:~# cat /proc/mtd
dev:    size   erasesize  name
mtd0: 00100000 00020000 "u-boot"
mtd1: 00200000 00020000 "uImage"
mtd2: 07d00000 00020000 "root"

root@nas:~# cat /proc/mounts
rootfs / rootfs rw 0 0
ubi0:rootfs / ubifs rw,relatime 0 0
tmpfs /run tmpfs rw,nosuid,nodev,noexec,relatime,size=12448k,mode=755 0 0
tmpfs /run/lock tmpfs rw,nosuid,nodev,noexec,relatime,size=5120k 0 0
tmpfs /tmp tmpfs rw,nosuid,nodev,noexec,relatime,size=32768k 0 0
proc /proc proc rw,nosuid,nodev,noexec,relatime 0 0
sysfs /sys sysfs rw,nosuid,nodev,noexec,relatime 0 0
tmpfs /dev tmpfs rw,relatime,size=10240k,mode=755 0 0
tmpfs /run/shm tmpfs rw,nosuid,nodev,relatime,size=24896k 0 0
devpts /dev/pts devpts rw,nosuid,noexec,relatime,gid=5,mode=620 0 0
tmpfs /var/tmp tmpfs rw,nosuid,nodev,noexec,relatime,size=8192k 0 0

root@nas:~# df
Filesystem     1K-blocks  Used Available Use% Mounted on
rootfs            114832 78288     36544  69% /
ubi0:rootfs       114832 78288     36544  69% /
tmpfs              12448   164     12284   2% /run
tmpfs               5120     0      5120   0% /run/lock
tmpfs              32768     0     32768   0% /tmp
tmpfs              10240     0     10240   0% /dev
tmpfs              24896     0     24896   0% /run/shm
tmpfs               8192     0      8192   0% /var/tmp

Offline

 

#4 2015-01-18 22:25:57

thecrow2003
Member
Registered: 2015-01-18
Posts: 6

Re: Question about 320 with Debian

boot output:

** MARVELL BOARD: DB-88F6281A-BP LE

U-Boot 1.1.4 (Jan 21 2011 - 11:56:48) Marvell version: 3.4.14.DNS-320_03

U-Boot code: 00600000 -> 0067FFF0  BSS: -> 006CEE80

Soc: MV88F6281 Rev 3 (DDR2)
CPU running @ 800Mhz L2 running @ 400Mhz
SysClock = 200Mhz , TClock = 166Mhz

DRAM CAS Latency = 3 tRP = 3 tRAS = 8 tRCD=3
DRAM CS[0] base 0x00000000   size 128MB
DRAM Total size 128MB  16bit width
Flash:  0 kB
Addresses 8M - 0M are saved for the U-Boot usage.
Mem malloc Initialization (8M - 7M): Done
NAND:128 MB

CPU : Marvell Feroceon (Rev 1)

Streaming disabled
Write allocate disabled


USB 0: host mode
PEX 0: interface detected no Link.
Net:   egiga0 [PRIME]
Hit any key to stop autoboot:  1  0

NAND read: device 0 offset 0x100000, size 0x200000
load addr ....  =1000000

2097152 bytes read: OK
## Booting image at 01000000 ...
   Image Name:   Linux-3.4.11
   Created:      2012-09-18  21:14:47 UTC
   Image Type:   ARM Linux Kernel Image (uncompressed)
   Data Size:    1908904 Bytes =  1.8 MB
   Load Address: 00008000
   Entry Point:  00008000
   Verifying Checksum ... OK
OK

Starting kernel ...

Uncompressing Linux... done, booting the kernel.
Booting Linux on physical CPU 0
Linux version 3.4.11 (mencak@shr) (gcc version 4.4.5 (Debian 4.4.5-8) ) #1 PREEMPT Tue Sep 18 23:14:18 CEST 2012
CPU: Feroceon 88FR131 [56251311] revision 1 (ARMv5TE), cr=00053977
CPU: VIVT data cache, VIVT instruction cache
Machine: D-Link DNS-320
Memory policy: ECC disabled, Data cache writeback
Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 32512
Kernel command line: mtdparts=orion_nand:1M(u-boot)ro,2M(uImage),-(root) console=ttyS0,115200 rw panic=10 ubi.mtd=root root=ubi0:rootfs rootfstype=ubifs
PID hash table entries: 512 (order: -1, 2048 bytes)
Dentry cache hash table entries: 16384 (order: 4, 65536 bytes)
Inode-cache hash table entries: 8192 (order: 3, 32768 bytes)
Memory: 128MB = 128MB total
Memory: 124312k/124312k available, 6760k reserved, 0K highmem
Virtual kernel memory layout:
    vector  : 0xffff0000 - 0xffff1000   (   4 kB)
    fixmap  : 0xfff00000 - 0xfffe0000   ( 896 kB)
    vmalloc : 0xc8800000 - 0xff000000   ( 872 MB)
    lowmem  : 0xc0000000 - 0xc8000000   ( 128 MB)
    modules : 0xbf000000 - 0xc0000000   (  16 MB)
      .text : 0xc0008000 - 0xc048ed2c   (4636 kB)
      .init : 0xc048f000 - 0xc04b6000   ( 156 kB)
      .data : 0xc04b6000 - 0xc04e6d20   ( 196 kB)
       .bss : 0xc04e6d44 - 0xc05765c4   ( 575 kB)
SLUB: Genslabs=13, HWalign=32, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
NR_IRQS:114
gpiochip_add: registered GPIOs 0 to 31 on device: orion_gpio0
gpiochip_add: registered GPIOs 32 to 49 on device: orion_gpio1
sched_clock: 32 bits at 166MHz, resolution 5ns, wraps every 25769ms
Console: colour dummy device 80x30
Calibrating delay loop... 795.44 BogoMIPS (lpj=3977216)
pid_max: default: 32768 minimum: 301
Mount-cache hash table entries: 512
CPU: Testing write buffer coherency: ok
Setting up static identity map for 0x386f58 - 0x386f94
NET: Registered protocol family 16
Kirkwood: MV88F6281-A1, TCLK=166666667.
Feroceon L2: Enabling L2
Feroceon L2: Cache support initialised.
PCI-E Device ID: MV88F6281, configuring power-off
dnskw: Setting power-recover on
bio: create slab <bio-0> at 0
vgaarb: loaded
SCSI subsystem initialized
usbcore: registered new interface driver usbfs
usbcore: registered new interface driver hub
usbcore: registered new device driver usb
Switching to clocksource orion_clocksource
NET: Registered protocol family 2
IP route cache hash table entries: 1024 (order: 0, 4096 bytes)
TCP established hash table entries: 4096 (order: 3, 32768 bytes)
TCP bind hash table entries: 4096 (order: 2, 16384 bytes)
TCP: Hash tables configured (established 4096 bind 4096)
TCP: reno registered
UDP hash table entries: 256 (order: 0, 4096 bytes)
UDP-Lite hash table entries: 256 (order: 0, 4096 bytes)
NET: Registered protocol family 1
RPC: Registered named UNIX socket transport module.
RPC: Registered udp transport module.
RPC: Registered tcp transport module.
RPC: Registered tcp NFSv4.1 backchannel transport module.
NFS: Registering the id_resolver key type
msgmni has been set to 242
io scheduler noop registered
io scheduler deadline registered
io scheduler cfq registered (default)
mv_xor_shared mv_xor_shared.0: Marvell shared XOR driver
mv_xor_shared mv_xor_shared.1: Marvell shared XOR driver
mv_xor mv_xor.0: Marvell XOR: ( xor cpy )
mv_xor mv_xor.1: Marvell XOR: ( xor fill cpy )
mv_xor mv_xor.2: Marvell XOR: ( xor cpy )
mv_xor mv_xor.3: Marvell XOR: ( xor fill cpy )
Serial: 8250/16550 driver, 2 ports, IRQ sharing disabled
serial8250.0: ttyS0 at MMIO 0xf1012000 (irq = 33) is a 16550A
console [ttyS0] enabled
serial8250.1: ttyS1 at MMIO 0xf1012100 (irq = 34) is a 16550A
brd: module loaded
loop: module loaded
sata_mv sata_mv.0: slots 32 ports 2
scsi0 : sata_mv
scsi1 : sata_mv
ata1: SATA max UDMA/133 irq 21
ata2: SATA max UDMA/133 irq 21
NAND device: Manufacturer ID: 0xec, Chip ID: 0xf1 (Samsung NAND 128MiB 3,3V 8-bit)
Scanning device for bad blocks
Bad eraseblock 363 at 0x000002d60000
3 cmdlinepart partitions found on MTD device orion_nand
Creating 3 MTD partitions on "orion_nand":
0x000000000000-0x000000100000 : "u-boot"
0x000000100000-0x000000300000 : "uImage"
0x000000300000-0x000008000000 : "root"
UBI: attaching mtd2 to ubi0
UBI: physical eraseblock size:   131072 bytes (128 KiB)
UBI: logical eraseblock size:    129024 bytes
UBI: smallest flash I/O unit:    2048
UBI: sub-page size:              512
UBI: VID header offset:          512 (aligned 512)
UBI: data offset:                2048
UBI: max. sequence number:       1217486
UBI: attached mtd2 to ubi0
UBI: MTD device name:            "root"
UBI: MTD device size:            125 MiB
UBI: number of good PEBs:        999
UBI: number of bad PEBs:         1
UBI: number of corrupted PEBs:   0
UBI: max. allowed volumes:       128
UBI: wear-leveling threshold:    4096
UBI: number of internal volumes: 1
UBI: number of user volumes:     1
UBI: available PEBs:             0
UBI: total number of reserved PEBs: 999
UBI: number of PEBs reserved for bad PEB handling: 9
UBI: max/mean erase counter: 3373/1218
UBI: image sequence number:  581589681
UBI: background thread "ubi_bgt0d" started, PID 488
mv643xx_eth: MV-643xx 10/100/1000 ethernet driver version 1.4
mv643xx_eth smi: probed
mv643xx_eth_port mv643xx_eth_port.0: eth0: port 0 with MAC address b8:a3:86:08:14:40
ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
orion-ehci orion-ehci.0: Marvell Orion EHCI
orion-ehci orion-ehci.0: new USB bus registered, assigned bus number 1
ata1: SATA link up 3.0 Gbps (SStatus 123 SControl F300)
orion-ehci orion-ehci.0: irq 19, io mem 0xf1050000
ata1.00: ATA-9: WDC WD20EZRX-00D8PB0, 80.00A80, max UDMA/133
ata1.00: 3907029168 sectors, multi 0: LBA48 NCQ (depth 31/32)
orion-ehci orion-ehci.0: USB 2.0 started, EHCI 1.00
hub 1-0:1.0: USB hub found
hub 1-0:1.0: 1 port detected
Initializing USB Mass Storage driver...
usbcore: registered new interface driver usb-storage
USB Mass Storage support registered.
mousedev: PS/2 mouse device common for all mice
rtc-mv rtc-mv: rtc core: registered rtc-mv as rtc0
ata1.00: configured for UDMA/133
i2c /dev entries driver
gpio-fan gpio-fan: GPIO fan initialized
orion_wdt: Initial timeout 25 sec
cpuidle: using governor ladder
scsi 0:0:0:0: Direct-Access     ATA      WDC WD20EZRX-00D 80.0 PQ: 0 ANSI: 5
cpuidle: using governor menu
sd 0:0:0:0: [sda] 3907029168 512-byte logical blocks: (2.00 TB/1.81 TiB)
sd 0:0:0:0: [sda] 4096-byte physical blocks
sd 0:0:0:0: [sda] Write Protect is off
sd 0:0:0:0: [sda] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
oprofile: hardware counters not available
oprofile: using timer interrupt.
TCP: cubic registered
NET: Registered protocol family 10
NET: Registered protocol family 17
Registering the dns_resolver key type
input: gpio-keys as /devices/platform/gpio-keys/input/input0
rtc-mv rtc-mv: setting system clock to 2015-01-18 20:28:20 UTC (1421612900)
ata2: SATA link up 3.0 Gbps (SStatus 123 SControl F300)
ata2.00: ATA-9: WDC WD20EZRX-00D8PB0, 80.00A80, max UDMA/133
ata2.00: 3907029168 sectors, multi 0: LBA48 NCQ (depth 31/32)
ata2.00: configured for UDMA/133
scsi 1:0:0:0: Direct-Access     ATA      WDC WD20EZRX-00D 80.0 PQ: 0 ANSI: 5
sd 1:0:0:0: [sdb] 3907029168 512-byte logical blocks: (2.00 TB/1.81 TiB)
sd 1:0:0:0: [sdb] 4096-byte physical blocks
sd 1:0:0:0: [sdb] Write Protect is off
sd 1:0:0:0: [sdb] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
sda: unknown partition table
sd 0:0:0:0: [sda] Attached SCSI disk
sdb: unknown partition table
sd 1:0:0:0: [sdb] Attached SCSI disk
UBIFS: mounted UBI device 0, volume 0, name "rootfs"
UBIFS: file system size:   125798400 bytes (122850 KiB, 119 MiB, 975 LEBs)
UBIFS: journal size:       9033728 bytes (8822 KiB, 8 MiB, 71 LEBs)
UBIFS: media format:       w4/r0 (latest is w4/r0)
UBIFS: default compressor: zlib
UBIFS: reserved for root:  0 bytes (0 KiB)
VFS: Mounted root (ubifs filesystem) on device 0:11.
Freeing init memory: 156K

INIT: version 2.88 booting

[info] Using makefile-style concurrent boot in runlevel S.
[....] Starting the hotplug events dispatcher: udevd[?25l[?1c7[ ok 8[?25h[?0c.
[....] Synthesizing the initial hotplug events...[?25l[?1c7[ ok 8[?25h[?0cdone.
[....] Waiting for /dev to be fully populated...[?25l[?1c7[ ok 8[?25h[?0cdone.
[....] Generating udev events for MD arrays...[?25l[?1c7[ ok 8[?25h[?0cdone.
[....] Setting parameters of disc: (none)[?25l[?1c7[ ok 8[?25h[?0c.
[....] Activating swap...[?25l[?1c7[ ok 8[?25h[?0cdone.
[....] Loading kernel modules...[?25l[?1c7[ ok 8[?25h[?0cdone.
[....] Activating lvm and md swap...[?25l[?1c7[ ok 8[?25h[?0cdone.
[....] Checking file systems...fsck from util-linux 2.20.1
[?25l[?1c7[ ok 8[?25h[?0cdone.
[....] Mounting local filesystems...[?25l[?1c7[ ok 8[?25h[?0cdone.
[....] Activating swapfile swap...[?25l[?1c7[ ok 8[?25h[?0cdone.
[....] Cleaning up temporary files...[?25l[?1c7[ ok 8[?25h[?0c.
[....] Configuring network interfaces...ADDRCONF(NETDEV_UP): eth0: link is not ready
[?25l[?1c7[ ok 8[?25h[?0cdone.
[....] Cleaning up temporary files...[?25l[?1c7[ ok 8[?25h[?0c.
[....] Setting kernel variables ...[?25l[?1c7[ ok 8[?25h[?0cdone.

INIT: Entering runlevel: 2

[info] Using makefile-style concurrent boot in runlevel 2.
[....] Starting periodic command scheduler: cron[?25l[?1c7[ ok 8[?25h[?0c.
Starting Dropbear SSH server: dropbear.
[....] Starting MD monitoring service: mdadm --monitor[?25l[?1c7[ ok 8[?25h[?0c.
[....] Starting rsync daemon: rsync[?25l[?1c7[ ok 8[?25h[?0c.
[....] Starting disk spindown daemon: spindownd[?25l[?1c7[ ok 8[?25h[?0c.
Starting FTP server: vsftpd.
ip_tables: (C) 2000-2006 Netfilter Core Team

Debian GNU/Linux wheezy/sid nas ttyS0

nas login:

Offline

 

#5 2015-01-18 22:34:12

thecrow2003
Member
Registered: 2015-01-18
Posts: 6

Re: Question about 320 with Debian

Marvell_DNS320>> printenv

baudrate=115200
loads_echo=0
rootpath=/mnt/ARM_FS/
netmask=255.255.255.0
console=console=ttyS0,115200 mtdparts=nand_mtd:0xc0000@0(uboot)ro,0x7f00000@0x100000(root)
CASset=min
MALLOC_len=1
ethprime=egiga0
bootargs_root=root=/dev/nfs rw
bootargs_end=:::DB88FXX81:eth0:none
image_name=uImage
standalone=fsload 0x2000000 $(image_name);setenv bootargs $(console) root=/dev/mtdblock0 rw ip=$(ipaddr):$(serverip)$(bootargs_end) $(mvPhoneConfig); bootm 0x2000000;
ethmtu=1500
mvPhoneConfig=mv_phone_config=dev0:fxs,dev1:fxs
mvNetConfig=mv_net_config=(00:11:88:0f:62:81,0:1:2:3),mtu=1500
usb0Mode=host
yuk_ethaddr=00:00:00:EE:51:81
nandEcc=1bit
netretry=no
rcvrip=169.254.100.100
loadaddr=0x02000000
autoload=no
ethact=egiga0
ethaddr=B8:A3:86:08:14:40
ipaddr=192.168.0.251
serverip=192.168.0.254
arcNumber=3985
bootargs=mtdparts=orion_nand:1M(u-boot)ro,2M(uImage),-(root) console=ttyS0,115200 rw panic=10
flash_bootargs=ubi.mtd=root root=ubi0:rootfs rootfstype=ubifs
bootcmd=setenv bootargs $(bootargs) $(flash_bootargs) ; nand read.e 0x1000000 0x00100000 0x00200000 ; bootm 0x1000000
stdin=serial
stdout=serial
stderr=serial
mainlineLinux=yes
enaMonExt=no
enaCpuStream=no
enaWrAllo=no
pexMode=RC
disL2Cache=no
setL2CacheWT=yes
disL2Prefetch=yes
enaICPref=yes
enaDCPref=yes
sata_dma_mode=yes
netbsd_en=no
vxworks_en=no
bootdelay=1
disaMvPnp=no
enaAutoRecovery=yes

Environment size: 1355/131068 bytes
Marvell_DNS320>>

Offline

 

#6 2015-01-19 11:02:14

Mijzelf
Member / Developer
Registered: 2008-07-05
Posts: 709

Re: Question about 320 with Debian

OK, your box runs full Debian from flash. There is a 125MiB rootfs, from which 36544 KiB is still free.

Your disks are <2TiB, so you can use fdisk to partition them.

Code:

fdisk /dev/sda

Press 'm' for help. You can create a swap partition, and a data partition. For swap 512MiB is fine.

Assuming the swap partition is 1, you can initialize and use it:

Code:

mkswap /dev/sda1
swapon /dev/sda1

and put a filesystem on partition 2 and mount it:

Code:

mkfs.ext4 /dev/sda2
mkdir -p /mnt/sda2
mount /dev/sda2 /mnt/sda2

Now you can add them to /etc/fstab to auto use/mount them on boot:

Code:

echo "/dev/sda1 none swap sw 0 0" >>/etc/fstab
echo "/dev/sda2 /mnt/sda2 auto defaults 0 0" >>/etc/fstab

eth0: link is not ready
Starting Dropbear SSH server: dropbear.

Is the network cable inserted? If yes, you can have a look with 'ifconfig' to see your ip address. If you know the ip address, you should be able to login using ssh.

Offline

 

#7 2015-01-20 09:47:48

thecrow2003
Member
Registered: 2015-01-18
Posts: 6

Re: Question about 320 with Debian

Thank you!!!!
Everything works fine , it was little issue with ssh - short investigation - source was closed by iptables.
Now i will try to  RAID  my disks.
I have another question : I want to install some software like samba , apache, sql, php, etc , as i understand by default it will try to install to flash memory , where is OS installed, how can i install software to hard drive ?
Thank You one more time ! smile

Offline

 

#8 2015-01-20 10:54:07

Mijzelf
Member / Developer
Registered: 2008-07-05
Posts: 709

Re: Question about 320 with Debian

There are several ways for that. You can move your whole rootfs to disk, which can also be done in (at least) 2 ways:
- Change u-boot environment so the initial rootfs is a disk partition.
- Exchange /sbin/init by a script which mounts the partition (or raid array), and does a switch_root, before calling /sbin/init on the new rootfs. And if that fails, it can execute the original /sbin/init.

But you can also put parts of the rootfs on disk. All auxiliary packages are normally installed in /usr. So you can copy the whole /usr tree to disk

Code:

mkdir /mnt/sda2/usr 
cp -a /usr/* /mnt/sda2/usr/

, and point /usr to it. And again, this can be done in several ways. You can simply exchange /usr by a symlink to /mnt/sda2/usr/. This has a backside that if you pull the disk, or if it dies, you won't be able to ssh in anymore. (sshd is also in /usr). You can also bindmount  /mnt/sda2/usr/ on /usr

Code:

mount -o bind,force /mnt/sda2/usr /usr

If this works, you can add it to fstab:

Code:

/mnt/sda2/usr /usr none bind,force 0 0

(The force is needed because /usr is not empty. Some versions of mount complain about that.)

If that works you can do the same for /var. Have a look in your /etc/fstab, make sure the mounts are in the right sequence. Some tmpfs are mounted in /var, this must be done after bindmounting /var, else the tmpfs mounts will be hidden and unused.

This way the major part of your new packages, including the packagemanagement itself will be stored on disk, only their config files (in /etc) will be in flash. If your disk fails, you'll be back in the original configuration (the bindmounts will fail, and the original /usr and /var are usable again.)

Offline

 

#9 2015-01-20 12:55:45

thecrow2003
Member
Registered: 2015-01-18
Posts: 6

Re: Question about 320 with Debian

God bless you !smile)
Thank You for you fast and  productive help!
With best regards
Yuri.

Offline

 

Board footer

Powered by PunBB
© Copyright 2002–2010 PunBB