create a virtual floppy image without mount? [closed] - linux

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 4 years ago.
Improve this question
There are a lot of posts to show to create a virtual floppy image file as a super user or users can run sudo command. The basic steps are:
create empty 1.44MB image file by dd command
format the image file by mkfs.msdos
mount the image file to some mount point
copy something to the mount point
umount the virtual floppy image file
my question is, in case I am just a common user who cannot run sudo command, how can I follow above steps to create a virtual floppy image and write something in it?
Thanks a lot.

Yes, of course you can do this. Use mtools for the FAT and e2tools or genext2fs for the ext2 filesystems.
$ dd if=/dev/zero of=/tmp/disk1.img count=1440 bs=1k
1440+0 records in
1440+0 records out
1474560 bytes (1.5 MB) copied, 0.00569719 s, 259 MB/s
$ /sbin/mkfs.msdos /tmp/disk1.img
mkfs.msdos 3.0.12 (29 Oct 2011)
$ mdir -i /tmp/disk1.img
Volume in drive : has no label
Volume Serial Number is 9913-BFF6
Directory for ::/
No files
1 457 664 bytes free
$ mcopy -i /tmp/disk1.img /etc/issue.net ::/
$ mdir -i /tmp/disk1.img
Volume in drive : has no label
Volume Serial Number is 9913-BFF6
Directory for ::/
issue net 28 2012-06-26 10:49
1 file 28 bytes
1 457 152 bytes free
And of course, I have no root rights.

Related

PLEASE HELP! I mounted the new HDD to existing folder (where another HDD has been mounted), and all files (in other HDD) have disappeared [closed]

Closed. This question is not about programming or software development. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 2 days ago.
Improve this question
I have recently bought a new 8TB HDD (barracuda) and tried to connect and mount the HDD to ubuntu system.
However, I made some mistakes and accidentally mounted the HDD to existing folder, where another HDD has been mounted.
Specifically,
(Before buying new HDD) I had 1 SSD & 1 HDD (will denote as HDD1 from now on), where
SSD: /dev/sda ==> Mounted on /home/{username}/SSD via
mount /dev/sda /home/{username}/SSD
HDD1: /dev/sdc1 ==> Mounted on /home/{username}/HDD1 via
mount /dev/sdc1 /home/{username}/HDD1
After buying new HDD, I have connected the HDD and
tried to do:
HDD2: /dev/sdb1 ==> Mount on /home/{username}/HDD2
what I have actually done
mount /dev/sdb1 /home/{username}
--> Mounted /dev/sdb1 to /home/{username}
After running this comman, all the files in HDD1 and SSD has been removed, and has been overwritten by HDD2's files.
I have read the post where the files are shadowed if mounted over it, but I am keep getting trouble restoring these files, and can't even find the files via
du -sh *
or
df -h
at root.
Are there any chances of this procedure overwriting the files in HDD1 and SSD? Are there any ways to restore back the files? PLEASE HELP!!!!!
WHAT I HAVE TRIED
1.
sudo -i
sudo umount /home/{username}
but
error: target is busy
came up.
So I have killed all the processes running on /home/{username} via
fuser -ck /home/{username}
Now I am completely locked in a state where I can't open /home/{username}/HDD and only terminal is available.
2.
I have tried df -h after doing (at root user, via sudo -i)
and following messages come up.
df: /home/{username}/SSD: Input/output error
df: /home/{username}/HDD1: Input/output error
Filesystem Size Used Avail Use% Mounted on
udev 63G 0 13G 0% /dev
...
/dev/loop14 56M 56M 0 100% /snap/core18/2697
/dev/sdb1 7.3T 3.5T 3.5T 51% /home/{username}

write error disk full in EC2 Machine [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 5 years ago.
Improve this question
I have my EC2 linux instance where some softwares are installed.
I downloaded a new zip and was trying to unzip it.
I got this error write error (disk full?). Continue? (y/n/^C) n
The zip is not corrupted and I can unzip it from other instances.
I change instance type from small to medium and then large.Nothing worked.
I ran df -h .
$ df -h
Filesystem Size Used Avail Use% Mounted on
devtmpfs 16G 56K 16G 1% /dev
tmpfs 16G 0 16G 0% /dev/shm
/dev/xvda1 9.8G 9.7G 0 100% /
I think /dev/xvda1 is culprit. How can i increase the size of this?
What is this /dev/xvda1
It is not a matter of instance type. You must change the volume (EBS) size.
Go to console and select the EBS of that instance , click action dropdown menu , then click modify volume ( A form will appear with the current volume size, increase it )
Try to remove some kilobytes to be able to run (3). rm -rf /tmp/* for example.
Grow/Expand your filesystem :
sudo growpart /dev/xvda 1
sudo resize2fs /dev/xvda1
NOTES :
check Step(1) by lsblk command and check step (3 ) by df -h
Scale down your instance before receiving a huge billing the end of month 😅 ( Let it small as it was )

Can I assign a device node to the mount point in /etc/fstab [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 7 years ago.
Improve this question
Host: Ubuntu 14.10
I have one line in my /etc/fstab file shown in the following:
UUID=00e12ac3-210d-53te-91ca-82a11226d5c8 /media/laptop/SSD/ ext4 errors=remount-ro 0 1
This SSD has its device node which is /dev/sda.
Is it possible to change it from /dev/sda to /dev/sdb in /etc/fstab file ?
If so, how can I modify it ?
The kernel assigns the device number when it detects the device. So when the first device that looks like a 'scsi disk' (sd) is detected, it is assigned the device-number (8, 0) and is thus /dev/sda. When the second is detected, it is (8, 16) and so on.
# ls -l /dev/sd[ab]
brw-rw----. 1 root disk 8, 0 Dec 6 2014 /dev/sda
brw-rw----. 1 root disk 8, 16 Dec 6 2014 /dev/sdb
You could, at your own risk!, swap the /dev/sda[ab]* entries, so they looked something like this:
# ls -l /dev/sd[ab]
brw-rw----. 1 root disk 8, 16 Jan 19 2016 /dev/sda
brw-rw----. 1 root disk 8, 8 Jan 19 2016 /dev/sdb
but I don't recommend that kind of hanky-panky unless you really know what you are doing and what all the possible ramifications are.
Instructions:
(su / sudo / login as root)
# cd /dev
# ls -l sd[ab]*
Note the device numbers, they may be different from mine!
Remove existing
# rm sd[ab]*
Make again with swapped minor device numbers
# mknod sda b 8 16
# mknod sda1 b 8 17
# mknod sdb b 8 0
# mknod sdb1 b 8 1
(you may need to alter your boot config, grub or whatever)
# reboot
Again, I stress this is at your own risk, I have no idea what on your system this could effect.

Cannot write to mounted (external) HDD [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 9 years ago.
Improve this question
I have tried mounting my external (usb) HDD, but eventhough the permissions match (between the user and the mounted disk) I cannot write, even as root. I tried mounting using pmount and "normal" mount.
System info:
Linux b2 2.6.39.4-4 #1 Fri Aug 19 14:41:59 CEST 2011 ppc GNU/Linux
User info:
zero#b2:~$ id -a
uid=1001(zero) gid=100(users) groups=100(users),46(plugdev)
pmount test:
zero#b2:~$ pmount /dev/sdb1 HDD
zero#b2:~$ mount
...
/dev/sdb1 on /media/HDD type ntfs (rw,noexec,nosuid,nodev,uid=1001,gid=100,umask=077,nls=utf8)
zero#b2:~$ stat /media/HDD/
File: `/media/HDD/'
Size: 4096 Blocks: 8 IO Block: 512 directory
Device: 811h/2065d Inode: 5 Links: 1
Access: (0700/drwx------) Uid: ( 1001/ zero) Gid: ( 100/ users)
zero#b2:~$ touch /media/HDD/testtouch
touch: cannot touch `/media/HDD/testtouch': Permission denied
I also cannot add any new directories.
Interestingly enough I CAN edit and save existing files (but not copy etc.)
test writing to existing file:
root#b2:/home/zero# mount -t ntfs /dev/sdb1 -o umask=022,gid=100,uid=1001 TEST/
root#b2:/home/zero# mount -l
...
/dev/sdb1 on /home/zero/TEST type ntfs (rw,umask=022,gid=100,uid=1001)
zero#b2:~$ cat TEST/test
zero#b2:~$ echo "writing text" > TEST/test
zero#b2:~$ cat TEST/test
writing text
Any ideas?
Read/write access to NTFS filesystems in the Linux kernel. Use ntfs-3g (FUSE) if you need read/write access.
sudo apt-get install ntfs-3g
sudo mount -t ntfs-3g /dev/sdb1 /media/HDD
sudo touch /media/HDD/I_can_write,_my_friends
NTFS-3G homepage:
http://www.tuxera.com/community/ntfs-3g-download/
More or support of NTFS in Debian:
https://wiki.debian.org/NTFS

How to resolve `FATAL: could not write lock file "postmaster.pid": No space left on device` error? [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
I have installed postgres 8.4.9 database in my fedora core 14 and deployed an application. It was working fine until today before I tried to restart the system. Now I am unable to start the pgsql. When I am trying to start I am getting the following error
FATAL: could not write lock file "postmaster.pid": No space left on device
I googled but was not able to find the solution for this issue.
Could someone please help in solving this issue?
This is the output of df -kh command:
Filesystem Size Used Avail Use% Mounted on
/dev/vda 9.9G 9.5G 0 100% /
tmpfs 2.0G 88K 2.0G 1% /dev/shm
This is not really a programming question so it should be on superuser.
Short answer -
reboot the system.
If the system comes back up, try:
find / -mtime -3 -size +100000 -exec ls -ls {} \; | sort -n
The largest newest files will be at the bottom of the list. If you can see that the file is not part of an app- a data file for example- remove it. You need at least 5% free space on /.
Long term you must add more disk space, like double or triple what you have.

Resources