Disk is write protected - dos

I am running a DOS program on Linux using dosemu on Ubuntu.
The program uses floppy disk, mounted on A:
I am able to create files in the floppy disk using the command line in dosemu. But when the program tries to write something on the floppy drive it returns an error Disk is write protected.

Related

How to identify the newly added disk in virtual linux(RHEL 7 &6) host using ansible yaml code

i am planing to write ansible playbook for file system creation. i am using Logical volume manager(LVM).
can any one help me to identify the new lun using ansible modules.
Generally speaking, this is very operating system specific. Your best path forward is to figure out what steps you would do from the command line to detect that there is a new disk and then use shell, parsing the result stdout. For example, on ubuntu, you might run fdisk -l and look for unpartitioned / unallocated drives and parse the output.

UBIFS: editted files are not saved. how to sync them to NAND?

I use UBIFS for rootfs on NAND.
When I edited a file like /etc/rc.local with nano command and saveed it,
"cat /etc/rc.local" shows the editted content, of course.
However after removing power supply (without reboot or poweroff command) and supply power again, the content of /etc/rc.local becomes empty.
I found that written data is not written to NAND straight away in UBIFS and written to cache. (refer: http://www.linux-mtd.infradead.org/faq/ubifs.html#L_empty_file)
I want to sync to NAND straightly after editting.
Only solution I found is fsync, but this should be called in C program and it requires file descripter. Nano command and so on does not give us file descripter. So I can not solve this sync problem.
How can I solve this not syncing to NAND problem?
Are there any command to sync?
Do I have to edit files with C program and use fsync if I want to edit and save a file in UBIFS?
You can use the 'sync' command. the system will flush all the cache to the disk.

How to use Udev correctly to call lshw ?

Env:
CentOS 6.9 in VM 12 Pro
I want to automatically get some hardware information after inserting a USB drive.
When I use Udev rules to call a script containing the lshw tool, I accidentally get some empty files.
For example:
When I execute the script directly, I can get the correct result.A HTML file that contains hardware information.
#!/bin/bash
lshw -html > /root/test.html
But when use udev rule named 11-add-usb.rules to call script.I can only generate an empty file.
ACTION!="add", GOTO="end"
KERNEL=="sd[a-z][0-9]", RUN+="/root/test.sh %k"
LABEL="end"

Mount VHD using GRUB2 loopback command

I need to mount a VHD file at grub2 command prompt.
I tries using "loopback" command as shown below:
grub > insmod ntfs
grub > insmod ntldr
grub > loopback loop (hd0,1)/test.vhd
grub > ls (loop)/
error: unknown filesystem
I tried both "static" and "dynamic" vhd and both VHD file had ntfs partitioned data.
I guess VHD files have some header data which makes the filesystem not recognizable after "loopback" mount. I am able to mount and access "iso" files using same set of commands.
Is my guess correct? If so, is there a way to overcome this issue?
Well, your guess is half right:
Whilst VHD supports a linear "fixed" storage model, which actually is just the raw data as it would be stored on a "real" hard drive, followed by a VHD footer, this is most probably not usually the case; VHD supports dynamically resizing images, which of course aren't linear internally, so you can't simply boot into that.
I was finally able to get the data from the loop mounted data with following change in the above pasted grub command.
grub > insmod ntfs
grub > loopback loop (hd0,1)/test.vhd
grub > ls (loop,1)/
The file "test.vhd" was a single partitioned VHD file.
NOTE: Only "fixed" or "static" model VHDs work. I could not get it working with "dynamic" VHD (as suggested by #Marcus Müller )
Thanks for the help. Hope this helps somebody.
To use VHD disks on grub2 need:
insmod part_msdos
insmod ntfs
loopback loop /point/where/disk.vhd tdisk=VHD
ls (loop,msdos1)/

Unmount my external hard drive in bash

So, this should apparently be really simple, but had trouble finding any good answers online.
I have a mounted external usb hard drive.
I would like to unmount it, using bash. (Essentially I'm just looking for the equivalent bash command for right clicking on my external hard drive in nautilus and selecting 'unmount')
How can I achieve this?
Searching for "Unmount Hard Drive Terminal" yields http://ubuntuforums.org/showthread.php?t=842698.
russlar provides a solution:
open terminal, and run df -h. this will tell you all the hard drives mounted. then, run sudo umount /dev/<something>, where <something> is the name of the hard drive that you want to unmount.

Resources