I want to disable fsck from doing a file system checks (yes I am aware of it's purpose). Online it says to edit the 6th column in the /etc/fstab file.
sed -i 's/ [1-]$/ 0/g' /etc/fstab
I have tried putting it when the kickstarter files run but it doesn't actually edit the file since it is memory. Am I looking to disabling fsck incorrectly or how should I do it?
Finally figured it out. There are two things that you can do. For rhel 7 you want to fsck.mode=skip to your boot_opts line. Then to be able to enable fsck back up, you edit fsck.mode=skip from your grub files then commit those changes to your grub file. grub2-mkconfig > /boot/grub2/grub.cfg. This will reactivate the fsck.
Related
Win 7
cygcheck (cygwin) 3.1.7
I created some mount points (mount winname name) years ago. I've just installed a new HDD and have to change the links.
There are some links where the owner:group is "?:?" (attributes are "??????????", size is "?" and time is "?"). I can not delete these links, change owner:group or chmod. They are inaccessible and return with an error message of "cannot access 'symlink': No such file or directory" whenever an operation is tried on them. But, they are listed under 'ls'.
I can not do a umount name. The error message is:
Is there any way that I can just delete these things and start over?
Well, I just forgot about mount tables (fstab). editing /etc/fstab solved my issues.
Sorry to have wasted your time.
After typed vim ~/.ssh/config in terminal, then got error message like picture1
what I did for solving
1.push D in the screen to try to delete swap file.but it looks like pointless
2.push r in the screen to confirm swap file.But I don't know how can I delete them.you can the condition in picture2.
please give me the tip how can I remove the error,
You can delete the swap file as suggested
rm /Users/snowman/.ssh/.config.swp
in case you edited the file using a different user (so you have no permission to delete the file) try
sudo rm /Users/snowman/.ssh/.config.swp
You can use rm as suggested by others including the answer from #Arsenio.
As you have multiple have files, you need to delete them one by one, of course
after recovering from the copy that you want.
\rm ~snowman/.ssh/.config.sw*
But newer version of vim, It is easier than rm and you already have newer version of vim which supports that.
New version of vim will have (D)elete it option. So you can
(R)ecover
followed by
:e!
At this point, we will have the same screen with (D)elete it. Now you can safely press D
Use
vim -r filename
and then there will be an option to delete the swap file.
I'm not even sure if this is easily possible, but I would like to list the files that were recently deleted from a directory, recursively if possible.
I'm looking for a solution that does not require the creation of a temporary file containing a snapshot of the original directory structure against which to compare, because write access might not always be available. Edit: If it's possible to achieve the same result by storing the snapshot in a shell variable instead of a file, that would solve my problem.
Something like:
find /some/directory -type f -mmin -10 -deletedFilesOnly
Edit: OS: I'm using Ubuntu 14.04 LTS, but the command(s) would most likely be running in a variety of Linux boxes or Docker containers, most or all of which should be using ext4, and to which I would most likely not have access to make modifications.
You can use the debugfs utility,
debugfs is a simple to use RAM-based file system specially designed
for debugging purposes
First, run debugfs /dev/hda13 in your terminal (replacing /dev/hda13 with your own disk/partition).
(NOTE: You can find the name of your disk by running df / in the terminal).
Once in debug mode, you can use the command lsdel to list inodes corresponding with deleted files.
When files are removed in linux they are only un-linked but their
inodes (addresses in the disk where the file is actually present) are
not removed
To get paths of these deleted files you can use debugfs -R "ncheck 320236" replacing the number with your particular inode.
Inode Pathname
320236 /path/to/file
From here you can also inspect the contents of deleted files with cat. (NOTE: You can also recover from here if necessary).
Great post about this here.
So a few things:
You may have zero success if your partition is ext2; it works best with ext4
df /
Fill mount point with result from #2, in my case:
sudo debugfs /dev/mapper/q4os--desktop--vg-root
lsdel
q (to exit out of debugfs)
sudo debugfs -R 'ncheck 528754' /dev/sda2 2>/dev/null (replace number with one from step #4)
Thanks for your comments & answers guys. debugfs seems like an interesting solution to the initial requirements, but it is a bit overkill for the simple & light solution I was looking for; if I'm understanding correctly, the kernel must be built with debugfs support and the target directory must be in a debugfs mount. Unfortunately, that won't really work for my use-case; I must be able to provide a solution for existing, "basic" kernels and directories.
As this seems virtually impossible to accomplish, I've been able to negotiate and relax the requirements down to listing the amount of files that were recently deleted from a directory, recursively if possible.
This is the solution I ended up implementing:
A simple find command piped into wc to count the original number of files in the target directory (recursively). The result can then easily be stored in a shell or script variable, without requiring write access to the file system.
DEL_SCAN_ORIG_AMOUNT=$(find /some/directory -type f | wc -l)
We can then run the same command again later to get the updated number of files.
DEL_SCAN_NEW_AMOUNT=$(find /some/directory -type f | wc -l)
Then we can store the difference between the two in another variable and update the original amount.
DEL_SCAN_DEL_AMOUNT=$(($DEL_SCAN_ORIG_AMOUNT - $DEL_SCAN_NEW_AMOUNT));
DEL_SCAN_ORIG_AMOUNT=$DEL_SCAN_NEW_AMOUNT
We can then print a simple message if the number of files went down.
if [ $DEL_SCAN_DEL_AMOUNT -gt 0 ]; then echo "$DEL_SCAN_DEL_AMOUNT deleted files"; fi;
Return to step 2.
Unfortunately, this solution won't report anything if the same amount of files have been created and deleted during an interval, but that's not a huge issue for my use case.
To circumvent this, I'd have to store the actual list of files instead of the amount, but I haven't been able to make that work using shell variables. If anyone could figure that out, I'd help me immensely as it would meet the initial requirements!
I'd also like to know if anyone has comments on either of the two approaches.
Try:
lsof -nP | grep -i deleted
history >> history.txt
Look for all rm statements.
I have modified the .vimrc file in my user. The settings dont work when i switch to superuser.
When i check the contents of the file (using vim editor) i can see the mapped keystrokes of newlines
(with all the text extending on the rightside beyond screen on same line), but when i check the contents of .vimrc as root, i see all the text in the same window screen one below the other (this may be a very stupid difference, but that is the only difference i noticed. all the data in the file is same).
i am unable to understand what is wrong and how can i correct it.
root is a user too, when you start vim with root, vim load the root's Home/.vimrc usually it is /root/.vimrc
You can cp or ln -s your user's vimrc to /root if this is a personal desktop machine.
I hope I understood your problem.
You did not state a precise question, so for the sake of completeness :
If what you want is being able to modify files as root using your user's vim and .vimrc, you can do
sudo -e /path/to/your/file
sudo will use the editor configured in $EDITOR as the current user, to edit a temporary copy of the file that will get copied over when you write the file.
The caveat is that you will not be able to have any edition history between sessions. For example, if you modify /etc/group once, save the changes and quit, and then reopen the file again, you will not be able to undo the modification you did at first.
For Neovim users, you can do what comes next:
If your root user settings for neovim are important, make a
backup for those dotfiles.
Create a symbolic link from your default user to /root/.config directory.
sudo mv /root/.config/nvim /root/.config/nvim.bkp; sudo ln -s $HOME/.config/nvim /root/.config/
Be aware that some plugins may need some files that are not under
.config/nvim directory.
On Debian GNU/Linux there is also a shared configuration file in /usr/share/vim/vimrc. (Actually this is a soft link to /etc/vim/vimrc.) See the bottom of the man page on vim.
Need help. I have been editing a text file in vi , and i was able to save the changes before but now i am getting the above error whenever i am typing command to save the file. Please help .
You can, as vi (or, more likely, vim) is saying force a write by doing:
:w!
Alternatively, write the file to an alternative location:
:w! /path/to/other/location
To check where your backup files are being written (normally):
:se backup? backupdir? backupext?
Try to touch a file in that directory and see if your Operating System gives you an error to enlighten you as to why your editor cannot write there.
Had the same problem. Tried all options as above but it did not work. Then when I checked my disk space, it was full. Once I cleared some space then I was able to write back to file again.
P.S: This was in linux.
Had the same problem. It was because I installed vimconf as root. You need to change rights of files in ~/.vim directory and change owner to your user.
sudo chmod 0750 ~/.vim
sudo chown user ~/.vim
I had this same problem. Turns out it was due to running out of disk space. try creating a file using Ex) touch test.txt. If you get a message saying touch: cannot touch test.txt: No space left on device you will need to clear up space on your disk
I don't know what the cause was, but I moved by backupdir from . to ~/.vim/backups in my .vimrc and it solved it for me:
set backupdir=~/.vim/backups
I'd imagine some sort of tool was using the folder the file I was editing it in (Visual Studio 2013, in my case), but I'm not sure.
I've fixed this with:
sudo chown {user} ~/.cache/vim/* -R
where the "{user}" field is your user-name.
from within vi, try:
:w!
:help w! gives the following information:
*:w!*
:[range]w[rite]! [++opt] {file}
Write the specified lines to {file}. Overwrite an
existing file.
In my case my disk was full.
Here are some commands to verify this and find where the disk space is being taken. In my case it was the PHP log at over 20GB.
# see general disk space usage
df -h
# see current file and directory disk space usage. You can go to / and work your way in
du -sh *
Backup location can be given in .vimrc, e.g.:
set backupdir=~/.vim/backup
You may need to create this directory yourself.
Another possibility is that you put your backups in a centralized location (e.g. /tmp) and you edited a particular file as root. Then, the backup file will be owned by root and un-writeable by you as a mere mortal later.
In this case, the suggestion above to touch /tmp/atestfile won't show the problem! You'll have write permissions, no problem, but not to the particular backup file vim is trying to write.
Remove the file as root (sudo rm).
Note that the reason w! works is because vim writes the file without writing a backup file (you're insisting that it write despite the error).
I just started using nvim and I found my issue was that my borrowed premade vimrc file had a preset source in it.
grep -rnw ~/.config/nvim/ -e backup
.config/nvim/lua/custom/vimrc:132:set backupdir=~/.backup/,/tmp/
Like others here, creating that backup directory cleared my error message (~/.backup/)