PDA

View Full Version : Working with a persistent home on a NTFS partition



ugo
12-14-2005, 02:42 PM
Hi everybody,
since I thought this is very hot question, I was expecting there was exactly what I need on
this forum, but google didn't help me too much. Sorry if you're tired reading about that.

General problem:
I'm trying to figure out how to explain to students how they can work with knoppix
with a very wide range of possible hardware. Of course, a student might have a rather new
PC with NTFS only on the HD, without a floppy drive, without any USB peripheral to save his files
(I know this is very unsafe, but students do it).
Therefore, in such an "extreme" case it's very important to be able to work with a persistent home
on a NTFS partition.

Good news:
I did a few tries and I successfully created a persistent home. Let me recall the main steps I did with a
Knoppix 4.0.2 (for the benefit of any interested reader):
1) Put the CD in the driver during a Windows working session;
copy the "MkImage-ct.exe" utility from the CD to the HD, then execute it.
The dialog window is in german, but it is very simple to create a file KNOPPIX.IMG in the root
directory of your NTFS partition.
2) Reboot and start the Knoppix session, then you can run the creation of a persistent home
by clicking on the Knoppix menu -> configure -> create persistent home.
You must choice the same file you previously created in the Windows session, so that you
don't modify the dimensions of any existing (or not) file. This procedure seems safe enough
to Knoppix, which warns you are doing a delicate stuff, but it does the job.

This procedure is a little different and simpler with respect that suggested at the web page
http://www.knoppix.net/forum/viewtopic.php?t=18076&highlight=
The procedure suggested there didn't work in my tries, but perhaps that was good for the
Knoppix 3.8 only.


Bad news:
Every time I finished a working session in Knoppix (even without writing any file in the persistent
home, but I guess the system does it) and I rebooted, I couldn't immediately reload my persistent
home, because it appeared a message saying (at the end):
"the NTFS filesystem needs to be brought into a consistent state first by using
the Windows (TM) scandisk/chkdisk utility".
Afterwards, the Knoppix session could continue without working on the persistent home.
Thus, I've been forced to reboot again the PC, starting Windows, which did the check of the disk
and automatically rebooted. Therefore, I could restart either a new Windows session or a Knoppix
session with a persistent home where I've found my files.

Problem:
everything seems work correctly, BUT it seems that, after having worked with Knoppix with a
persistent home, I'm everytime forced to restart a Windows session (I've tried it more than once).

Question:
do you know how to avoid passing through Windows?


Many thanks for any help,
ciao,
Ugo


P.S. Of course, I could suggest to the students to resize ntfs and create a new (vfat or something in
linux) partition, where they can safely out the persistent home; but I guess they would be scared
about resizing.....

rwcitek
12-15-2005, 07:58 AM
I'd strongly recommend an external USB device. Many companies are giving away small USB sticks as swag. 16 MB is plenty for some simple file saving.


Question:
do you know how to avoid passing through Windows?
IIRC, you don't actually enter a full Windows session, but rather just it runs a chkdsk which then reboots.

But to answer your questions, try ntfsfix. I've never used it but it sounds like it might do the trick. The way this might work is to boot using the "-b" cheatcode (e.g. boot: knoppix -b) which drops you into emergency mode. Once there, type "ntfsfix /dev/hda1" assuming /dev/hda1 holds the ntfs partition. When it's done, type exit to continue booting Knoppix.

Give that a try and let us know how it goes.


P.S. Of course, I could suggest to the students to resize ntfs and create a new (vfat or something in
linux) partition, where they can safely out the persistent home; but I guess they would be scared
about resizing.....
IMHO, resizing is the best option if you don't have an external USB device. After resizing you should create a new ext2 partition to hold a persistent disk image (PDI). I used this method quite a bit in the internet cafes and kiosks while travelling in Argentina. I'd copy both the ISO from the CD and the PDI from my USB key to the disk. I'd also create a swapfile on the partition and booted using the "bootfrom=" cheatcode. When I was done I'd boot again and copy the PDI to my USB key. On slow machines this worked much faster than using the CD.

Good luck and let us know what works for you.

Regards,
- Robert
http://www.cwelug.org

ugo
12-15-2005, 10:23 AM
Dear Robert,
ntfsfix sounds good. I'll have a try next week (I have to go back in the PC classroom where I can text this situation, in all the
other PC's where I can access when Windows is there, the filesystem is vfat just to safely write from Linux in a dual boot environment).
Therefore, I'll let you know.

I understand very well your point of view about resizing, but for the students any pretext is good in order to not learn a little
about Linux and to continue badly working and programming under Windows....
For this reason, I'm trying to select the solutions with the minimum impact on the hardware and with a very little effort
for the students.
A very bad life for teachers....

Thanks a lot,
Ciao,
Ugo

markpreston
12-16-2005, 10:20 PM
Hi Ugo,
You might like to try out the following which I originally posted in http://www.knoppix.net/forum/viewtopic.php?t=21373. It should be available in Knoppix 4.02 I believe.

The following SNAPSHOT informastion (see below) is taken from the /dvd/KNOPPIX/linux-ntfs directory of Knoppix 4 (Linux Magazine November 2005 cover edition) regarding the recently current state as far as writing to ntfs partitions. This uses libntfs. (The Open-Source linux-ntfs library not the kernel driver, which is derived from it). The kernel module is usually about 6 months behind libntfs. According to the article by Klaus Knopper you can now delete files and directories, and create up to 9 new files or subdirectories within a directory. It is complicated to recompile every program to use libntfs for write operations, so they use the FUSE kernel module and a utility called ntfs-mount to actually mount the NTFS partition.
Hopefully the above background information will help when reading the SNAPSHOT information for developers below.
Regards,
Mark



LINUX-NTFS DEVELOPMENT SNAPSHOT
===============================

This version of KNOPPIX contains preliminary support for writing to
NTFS filesystems using the "filesystem in userspace" module [1],
plus a current (16-08-2005) snapshot of the linux-ntfs development
[2].

Both are preinstalled on this CD. Note that a "normal" mount of
an ntfs partition (by clicking on a partition in KDE, for example)
uses the safe version of the "read-only" linux-ntfs kernel module,
which has very limited but safe overwrite-capabilities, and most
certainly will NOT destroy your NTFS partitions accidentially.

In order to test and use the extended write capabilities of the
developer snapshot of linux-ntfs, you will have to follow the
commandline instructions below.

DISCLAIMER: THIS DEVELOPER'S SNAPSHOT VERSION OF LINUX-NTFS IS
EXPERIMENTAL AND YET INCOMPLETE. IT IS STILl EXPERIMENTAL SOFTWARE.
USE AT YOUR OWN RISK. MOST LIKELY, SOMETHING WILL BREAK IF YOU
USE THIS SOFTWARE WITHOUT CAUTION. KNOPPER.NET CAN NOT BE HELD
LIABLE UNDER ANY CIRCUMSTANCES FOR DAMAGE TO HARDWARE OR
SOFTWARE, LOST DATA, OR OTHER DIRECT OR INDIRECT DAMAGE RESULTING
FROM THE USE OF THIS SOFTWARE. IF THESE CONDITIONS ARE INACCEPTABLE
TO YOU, DON'T USE THIS SOFTWARE.

After that being said, here are the instructions. It is assumed that
you do this as "knoppix" user from the live filesystem. Make sure you
have a backup of all important data on your computer before.

# Step 1: Load the "Filesystem in Userspace" module.
sudo modprobe fuse

# Step 2: Make NTFS partition (example: /dev/hdd1) accessible for
# unprivileged users.
sudo chmod 666 /dev/hdd1

# Step 3: Create a mountpoint in your user home directory.
mkdir $HOME/ntfs

# Step 4: Mount the partition read/write
ntfsmount $HOME/ntfs -o dev=/dev/hdd1

You should now be able to access the content of the NTFS partition
at $HOME/ntfs. Don't forget to

# Step 5:
fusermount -u $HOME/ntfs

after you are done experimenting.

Please address technical contributions (debugging output, patches,
corrections) to the NTFS development team [2], but it does not make
much sense at this point to ask usability questions like "when
will official NTFS write support be in the kernel?" or "why is
NTFS so difficult", at this early stage.

Resources:
[1] http://fuse.sourceforge.net/ Filesystem in Userspace
[2] http://linux-ntfs.sourceforge.net/ Linux-NTFS Project
Regards,
Mark

ugo
12-20-2005, 10:27 AM
Dear Robert,
apparently, starting the boot process with
knoppix -b
doesn't work. In fact, after a little while the boot process stops by requiring the root password for maintenance (or, alternatively,
it suggests to type Ctrl-D to restart the normal bootup process).
The problem is that AT THIS POINT IT DOES NOTHING! I mean, the PC didn't answer to anything I tried to type from the keyboard.
Thus, I manually rebooted....

Have you further suggestions?
Let me repeat that ntfsfix sounded good. It's a pity I couldn't start it!

Thanks,
ciao,
Ugo

rwcitek
12-20-2005, 02:46 PM
The problem is that AT THIS POINT IT DOES NOTHING! I mean, the PC didn't answer to anything I tried to type from the keyboard.
You should be able to press the Enter key to start a bash shell in emergency mode.

What kind of keyboard do you have? PS/2, USB, something else?

Regards,
- Robert
http://www.cwelug.org

ugo
12-20-2005, 04:11 PM
Hi Robert,
I tried with the Enter key too.

The keyboard is connected of USB type.

Cheers,
Ugo

rwcitek
12-20-2005, 05:04 PM
The keyboard is connected of USB type.
Ahh. Unfortunatley, booting into emergency mode won't work with a USB keyboard, only with PS/2. That's because the USB drivers are not built into the kernel nor are any drivers loaded when entering emergency mode.

But the short term goal is to figure out if ntfsfix will work. For that, simply boot from the CD into single-user mode and don't use the persistent disk image (PDI):

boot: knoppix noswap 1
Then run ntfsfix. If it looks like ntfsfix worked, reboot as you normally would and use the PDI. If using the PDI works, then we can tackle a long-term solution.

Good luck and let us know how it goes.

Regards,
- Robert
http://www.cwelug.org

ugo
01-10-2006, 05:14 PM
Dear Robert,
I'm very sorry for having been silent so long. I know it's not serious, but I had very good reasons: my wife delivered our second child a week ago, so it's a long time I'm not going in the PC classroom where I did the previous tries.

However, I created a NTFS partition on my laptop (so, no problem for the USB keyboard) and I made a test which provided interesting (but undesired) results.

I made a persistent home, rebooted, and I wrote something on the persistent
home. Then, I rebooted as you suggested by using the cheatcode
knoppix noswap 1
and I've ran ntfsfix on the NTFS partition.
Then, I rebooted once again by scanning for the persistent home.

No chance! Knoppix still complains and requires to run the windows utility
to check and fix the NTFS partition.....

I've retried in order to be sure I was not wrong: same result!


The problem seems without a straight solution: isn'it?

I will try also by using FUSE, Mark's suggestion looks very interesting, but may be too difficult for students.


Thanks a lot.
Ciao,
Ugo

Rammel
01-11-2006, 02:34 PM
Hello ugo (congratulation to paternity*g)

i run exactly in the same problem (working with students too*g).
i tried hard to find a solution, but i had only luck with two workarounds:

1. the fuse-ntfs-thing did work-but, as u said, it takes much effort to test and document.
2. the unionfs-automated-thing does work for me IF i choose the options while starting knoppix like this:
[X] home
[ ] system
[ ] overwrite
[ ] init
...so the homedir is persitent, but /etc and global systemconfig isn't.

i think the problem with choosing [x]system is, that the KNOPPIX.IMG-file or the whole ntfs-partition doesn't unmount correct while shutting down knoppix. At least i wasn't able to umount KNOPPIX.IMG or the ntfs-partition by hand (always busy-errors).
i would be glad if we could find a better solution (saving systemconfig included) together.

Ciao,
Rammel

ugo
01-13-2006, 12:45 AM
Dear Rammel,
so simple, so effective: your suggestion works!
I would the student work at a rather low level from the point of view of the environment (they should do programming, computing, etc.) teachers only are allowed to play with Knoppix features... Thus, your suggestion could be enough, even if I think that the default settings are a little misleading (how many times the students will be wrong?).
I'll think about doing better, but I don't promise I'll succeed...

Thanks a lot,
ciao,
Ugo

OErjan
01-13-2006, 06:36 PM
how about making a /home/user/etc for the changes?
if you then make a script (or a program) checking for them on boot...
should not be impossible to achieve and would make using NTFS for config storage... safer and easyer.