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 2008-03-29 22:03:05

naffarin
Member
Registered: 2008-01-28
Posts: 47

Howto change main partition to ext2

Since my unit seems to be running more stable now with ext2 and a new samba here are the instructions how to change the filesystem.

A word of warning ahead: You will lose all the data on the ntfs partition, the itunes and upnp av media libraries. You will probably also need to install a new version of samba because the installed one seems to be causing errors. I don't know if your itunes library or the default upnp av server will still work as i am not using any of them.
MAKE A BACKUP before you start ! VERIFY your backup before you start !

As i am doing these instructions from memory, i may miss some parts so please forgive me if it's not 100% accurate.

Instructions:

Backup your data (you can't say this often enough)
Telnet into the dns-313 using user root
If you already have a fun_plug script copy it to somewhere outside of the dns 313
Execute the command

Code:

fdisk /dev/sda

( Notice: The default fdisk command core dumps on my dns 313 with a segmentation fault, in this case download an arm version of fdisk from e.g. http://packages.debian.org/etch/fdisk-udeb, unpack it with a debian package installer tool and transfer it to the dns 313)
Print the partition table with p<RETURN>
Delete partition /dev/sda2 by pressing d<RETURN> and choosing the right number (should be 2)
Delete partition /dev/sda4 by pressing d<RETURN> and choosing the right number (should be 4)
Add a new primary partion by pressing n<RETURN>, choose primary (p) and number 2
Use the default cylindeer and give it a size of at least 200M with +200M (this will be your ntfs partition, so if you want to use the dns 313 as a usb device give it enough space for data copied over usb) but leave enough space for the main partition
Add a new primary partion by pressing n<RETURN>, choose primary (p) and number 4
Use the default cylinder and use the rest of the available space
Change the partition type of partition 2 to type 7 (ntfs) by pressing t<RETURN>2<RETURN>7<RETURN>
Press w to save your changes.
It will tell you that the changes are available on next boot since the devices are in use.
Example

Code:

Command (m for help): d
Partition number (1-4): 2

Command (m for help): d
Partition number (1-4): 4

Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
p
Partition number (1-4): 2
First cylinder (1911-60301, default 1911):
Using default value 1911
Last cylinder or +size or +sizeM or +sizeK (1911-60301, default 60301): +200M
Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
p
Partition number (1-4): 4
First cylinder (5801-60301, default 5801):
Using default value 5801
Last cylinder or +size or +sizeM or +sizeK (5801-60301, default 60301):60301
Command (m for help): t
Partition number (1-4): 2
Hex code (type L to list codes): 7
Changed system type of partition 2 to 7 (HPFS/NTFS)
w

Shutdown your dns 313 now and connect it by usb to your windows pc. Enter the computer manager (naming?)  and choose volume manager, format partition 2 on the dns 313 with ntfs.
Mount the newly formatted partition to a windows drive letter
Create two files on the partition (pay attention that these are unix files, so don't use notepad or wordpad for this !!!):
First one named
fun_plug
containing

Code:

#!/bin/sh
#
# Simple fun_plug
#
#dmesg > /mnt/HD_a2/dmesg.out
cp /mnt/HD_a2/remount_disks.sh /
/remount_disks.sh &

second one named
remount_disks.sh
containing:

Code:

#!/bin/sh
while ( [ ! -f /tmp/boot_finished ] )
do
        sleep 5
done

sleep 5

kill `pidof smbd`
kill `pidof nmbd`

umount /dev/sda2
umount /dev/sda4

mount -t ext2 /dev/sda4 /mnt/HD_a2
mount -t ufsd /dev/sda2 /mnt/HD_a4
# make sure we can telnet into the device 
xinetd -stayalive -reuse -pidfile /var/run/xinetd.pid&
#this is the real fun plug now
/mnt/HD_a2/initialize_environment.sh
smbd -D
nmbd -D

-- Note to MAC Users:

There is an alternative path if you don't have a windows installation, but this is entirely untested by me.
Before starting fdisk execute the following commands (taken from /usr/sbin/fmt_user_partitions.sh)

Code:

for proname in crond atd smbd nmbd fancontrol op_server ubutton HDFullCheck \
mailalert pure-ftpd mt-daapd upnp; do
echo "to kill $proname"
kill -9 `pidof $proname`
done


umount /mnt/HD_a2
umount /mnt/HD_a4

execute the fdisk command as the instructions say above
then execute the following two commands:

mkntfs -f -L USER_DATA /dev/sda2
mke2fs -L DATA_BASE /dev/sda4

Execute mount -t ufsd /dev/sda2 /mnt/HD_a2
Create the two files fun_plug and remount_disks.sh as mentioned above on /mnt/HD_a2, then reboot your device.
-- Note to MAC Users end

Disconnect your drive from usb and reconnect it to the lan, then power up your device. This will take some time, because the main partition will be formatted automatically now, so don't be afraid if your device is not reachable for a few minutes ( i certainly was smile )

Telnet into your dns 313 again and check if /mnt/HD_a2 is now a ext2 partition by executing the command:
mount
It should output something like that

Code:

rootfs on / type rootfs (rw)
/dev/root on / type ext2 (rw,nogrpid)
/proc on /proc type proc (rw,nodiratime)
none on /dev/pts type devpts (rw)
tmpfs on /var/spool type tmpfs (rw)
/dev/sda4 on /mnt/HD_a2 type ext2 (rw,nogrpid)
/dev/sda2 on /mnt/HD_a4 type ufsd (rw)

The big ext2 partition is now mounted on HD_a2, the previous ntfs partition on HD_a4

If you previously had a fun_plug script, then copy it onto the dns-313 to /mnt/HD_a2/initialize_environment.sh to have it executed by the remount procedure.

That's all, so now check if your samba is making any problems by doing some large file transfers to the dns 313 (at least 500 MB data).
Keep a telnet connection open while you transfer the files. It may be possible that the telnet connection suddenly closes and you cannot connect to the dns 313 with the web interface, nor does it react on the power button.
In that case reopen a telnet connection and execute the following commands

Code:

/web/webs &
fancontrol &
ubutton&
/usr/sbin/HDFullCheck&
/usr/sbin/mailalert&
/usr/sbin/SyncMms&

This should restore your unit to the normal state, but better reboot it afterwards.

If you have this problem you need to install Samba 3.0.28a on your device, at least that solved the problem for me.

Good luck if you try this smile

Offline

 

#2 2008-09-09 12:13:04

Chibani
Member
Registered: 2008-09-09
Posts: 6

Re: Howto change main partition to ext2

Hi,
I've followed your tuto and it works fine ! Thanks a lot.
Just one thing :
I'm a mac user and I had some trouble unmounting /mnt/HD_a4... It told me it was unable to unmount this partition because it was in use ...?
Anyway, after restarting the DNS-313 everything was OK ^^
(I just had to update samba because of login problem)

Thanks again for your help !

Offline

 

#3 2008-11-05 14:12:12

eak
Member
Registered: 2007-11-01
Posts: 16

Re: Howto change main partition to ext2

Well i did this now i can write to disk in 13.5MB sek but i hawe no telnet access annymore because i don't know the default root password. and with funplug before i did not need to enter it. And i cannot insert the old funplug because i hawe no write access over smb in / of network mount.
how to fix this?

Offline

 

#4 2008-11-05 14:20:43

eak
Member
Registered: 2007-11-01
Posts: 16

Re: Howto change main partition to ext2

Tried ftp also but no write acces to /dev/sda4/

Solowed with some script trickery.
copying files on boot up and installing of funplug. well i get to enter root password but now i know it. and i get a shell that works.

Next mission is openVPN server on the disk so that I can connect to my network from other places and play lan games with my friends.

Last edited by eak (2008-11-05 16:06:01)

Offline

 

#5 2008-12-04 21:14:32

KimBP
Member
Registered: 2008-08-10
Posts: 8

Re: Howto change main partition to ext2

I come to the point where I'm told to login again and check that /mnt/HD_a2 is now ext2. I can't.

This is what I get:

Code:

root@kbp2:/NAS# telnet 10.0.0.10
Trying 10.0.0.10...
Connected to 10.0.0.10.
Escape character is '^]'.

Linux 2.6.15 (nas) (0)


nas login: root
Password: 
login: cannot run /ffp/bin/sh: No such file or directory
Connection closed by foreign host.
root@kbp2:/NAS#

Apparantly my root user still expect the ffp symbolic link to exist.

What have I done wrong?
What can I do to fix it?

Offline

 

#6 2008-12-04 21:19:39

KimBP
Member
Registered: 2008-08-10
Posts: 8

Re: Howto change main partition to ext2

One more issue: I can't copy any files into Volume_1 neither using samba from my UBUNTU nor windows share from a winXP.

Volume1 is the new big partition while the one I see when using DNS-313 as USB device is the "little" one

Offline

 

#7 2008-12-05 00:17:17

eak
Member
Registered: 2007-11-01
Posts: 16

Re: Howto change main partition to ext2

I don't remember what i did annymore but i guess that I changed the ffp script to copy stuff over to the ext2 partition. and running it from over there. I now run the debian stuff from the forum on it but I have quite a few issues with that.
So i'm thinking about seting up my own dist to run on it. with only exactly the stuff I want to run.

Offline

 

#8 2008-12-16 14:55:39

puffinfresh
New member
Registered: 2008-12-14
Posts: 2

Re: Howto change main partition to ext2

"unpack it with a debian package installer tool"
Say what?

Edit:
OK, I think I worked that step out. I just used 7-zip to unpack it and found the fdisk file. I completed all the steps, but when I type in 'mount' in Telnet toward the end, I get two things listed for sda4. One is the ext2 parition, and the other contains system files. So when I FTP into the drive, I end up seeing all the system files (eg lost+found) and I can't write anything to it. A SMB connection is the same, and it shows the correct disk size (~900gb). The webconfig only shows the 200mb drive.

Telnet:
# mount
/dev/ram0 on / type ext2 (rw,nogrpid)
none on /proc type proc (rw,nodiratime)
none on /dev/pts type devpts (rw)
/dev/sda3 on /mnt/sda3 type ext2 (rw,nogrpid)
tmpfs on /tmp type tmpfs (rw)
/dev/sda4 on /mnt/HD_a4 type ext2 (rw,nogrpid)
/dev/sda4 on /mnt/HD_a2 type ext2 (rw,nogrpid)
/dev/sda2 on /mnt/HD_a4 type ufsd (rw)


Webconfig:
Volume Name:     Volume_1
Total Hard Drive Capacity:     205 MB
Used Space:     14 MB
Unused Space:     191 MB

I guess I work out how to undo all this and I'll try again

Edit 2:
If/when it's needed... how do I update Samba?

Last edited by puffinfresh (2008-12-17 01:04:33)

Offline

 

#9 2008-12-23 19:28:54

naffarin
Member
Registered: 2008-01-28
Posts: 47

Re: Howto change main partition to ext2

puffinfresh wrote:

# mount
/dev/sda4 on /mnt/HD_a4 type ext2 (rw,nogrpid)
/dev/sda4 on /mnt/HD_a2 type ext2 (rw,nogrpid)
/dev/sda2 on /mnt/HD_a4 type ufsd (rw)
Edit 2:
If/when it's needed... how do I update Samba?

Wow, i would have thought it to be absolutely impossible to mount two devices to the same directory.
Anyway if this condition remains after rebooting the device then it probably failed to unmount /dev/sda2 correctly in the script remount_disks.sh

Sadly i can't tell you anything else than "It's working for me" as i am using this script combination since posting the guide and never encountered any issues with it.

The other samba version is linked in another thread in this forum , but fonz ffp has a newer version of it i think. Just remember to install ffp after changing the filesystem because filesystem links will be corrupted by changing the filesystem using the procedure described above

Offline

 

#10 2009-09-08 11:00:19

chaumurky
New member
Registered: 2009-09-04
Posts: 3

Re: Howto change main partition to ext2

OK, I know this is an old thread but I keep coming back to it as there's little information on the subject of using EXT2 as the main volume.

I have to admit - I gave up on this. It seems following these procedures lobotomised my ffp...

Instead, starting with a simple funplug install:

* I created a folder in /mnt/HD_a4 called Volume1

* copied /etc/samba/smb.conf to /mnt/HD_a2 and modified the share to point in to my new folder (chmodded 777)

* added the following to the end of fun_plug:
cp /mnt/HD_a2/smb.conf /etc/samba/
kill `pidof nmbd` && kill `pidof smbd`
smbd -D && nmbd -D

* Finally, in Windows, I used partition magic to shrink the ntfs partition (/dev/sda2) to 1G and enlarge the EXT2 partition (/dev/sda4).

No re-formatting re-mounting.

Granted I've only looked at Samba for now but can the rest be that hard?

Offline

 

Board footer

Powered by PunBB
© Copyright 2002–2010 PunBB