Windows 7 seems to mess up ext4 group descriptors - linux

I recently installed Linux Mint Debian Edition - it was installed into a logical partition (formatted to ext4) under a 40 GB extended partition that was previously used as a backup/recovery disk in Windows 7.
It works quite well - the only problem is when I boot to Windows, then next time, Linux won't boot. I then need to use a recovery distro and run fsck.ext4 which detects some problems with group descriptors, fixes them and it's all good again.
My feeling is that Windows tries to mount (and fix / defrag / whatever) that partition which messes it up - I suspect that, because 1) it only happens after I boot to Windows, 2) Windows still displays the old recovery/backup disk D: (although you cannot access it and it doesn't show a free/total space etc.).
Any idea how to fix it?

Just a shot in the dark, it could possibly be the listed partition type.
Check the disk with your favorite partition table editor (fdisk, cfdisk, parted, whatever), and check to see if your linux partitions are listed as Windows ones or if they are correctly listed as Linux. If they are listed wrong, you should safely be able to change this, and it could stop Windows from harassing you.

Related

Arch Linux not booting (Maybe related to not having left space for root)

I commited an error during my Arch Linux install that I don't know how to remedy, so I just sticked with it these months. I gave just ~35GB of storage space for the root partition.
This caused that for the last few months my PC have been warning about low space left in the root partition, but it was always of about ~400 MB, so I just ignored my problems thinking they would go away.
Today, I tried to boot Arch Linux, it goes all normal until the file system is started. It then leaves me with an unblinking selector in a black screen.
The output after that is exactly like this:
_
I cannot open a terminal with Ctrl + Alt + F1..F6, and I can't do anything.
I assume that this is happening because there is no space left in the root partition (Maybe the file system crashes), is that right? If it is, how could I increase the root partition space without having access to Arch Linux? Would reinstalling Arch Linux solve the problem?
This is my fault, I should have been more careful
This is what I would do in your situation:
Make a bootable USB with Balena Etcher
Boot from the USB
Run lsblk and df -h to get more information about your storage devices
If your old root partition is (almost) full, you can mount it from your Live USB environment and make some space.
You can also consider moving your home directory to a separate partition.

how to determine what sectors of partition are unused?

I have one MBR partition(NTFS) with Windows 8.1 installed on it. I wanna install Arch Linux as the second OS. I need to make new partition from unused space of existing one. Is it possible? If so, how to determine what "start" and "end" sector of existiing partition I need to specify to create new partition (to not damage existing one)?
Yes, this is possible. However, it isn't quite as easy as you might think.
You cannot simply look for a "start" and "end" sector, as the existing file system might have scattered its data all over the partition. The right thing to do is the following:
Determine how much free space is left in the file system, and how much you could possibly take away (the file system might have some expectations about that).Then, move all the data to the start of the partition, making sure the file system understands the data is in new places.
After that, you can alter the size of the partition itself, and create new partitions.
All together, that is not a trivial task, and is best done by partition managers that can do file system re-sizing. In your case, you want one that understands NTFS and probably also is standalone, i.e. runs from a live CD or something like that - I'm not sure you can resize a NTFS file system that is currently being used. Arch Linux might even provide a "boot" or "install" DVD that will do this.
You can use diskmgmt.msc command in run box of windows 8.1 to know what part is empty and also you can create partitions through this and create empty space required for your arch Linux installation. Hope it helps

centos free space on disk not updating

I am new to the linux and working with centos system ,
By running command df -H it is showing 82% if full, that is only 15GB is free.
I want some more extra spaces, so using WINSCP i hav done shift deleted the 15G record.
and execured df -H once again, but still it is showing 15 GB free. but the free size of the deleted
file where it goes.
Plese help me out in finding solution to this
In most unix filesystems, if a file is open, the OS will delete the file right way, but will not release space until the file is closed. Why? Because the file is still visible for the user that opened it.
On the other side, Windows used to complain that it can't delete a file because it is in use, seems that in later incarnations explorer will pretend to delete the file.
Some applications are famous for bad behavior related to this fact. For example, I have to deal with some versions of MySQL that will not properly close some files, over the time I can find several GB of space wasted in /tmp.
You can use the lsof command to list open files (man lsof). If the problem is related to open files, and you can afford a reboot, most likely it is the easiest way to fix the problem.

Is it possible to shutdown linux kernel and resume in Real Mode?

Let's say I'd like to start a small linux distro before my ordinary operating system start.
BIOS load MBR and execute MBR.
MBR locates the active partition which is my linux partition.
Linux start and I perform what I need to do.
Linux shut down and I switch to Real Mode again.
The original partition boot sector is loaded and my ordinary OS start.
AFAIK, step 4 will be the difficult task, restore the state on all devices prior to linux, will INT13h be functional? Do I need to restore the Interrupt Vector Table? To mention a few.
Has this been done in any existing project perhaps?
Linux does not normally support this, particularly since it reinitializes hardware in a way that the BIOS and DOS programs may not expect. However, there is some infrastructure to switch back to real mode in specific cases - particularly, for a reboot (see machine_real_restart in arch/x86/kernel/reboot.c) - and has code to reinitialize hardware for kexec or suspend. I suspect you might be able to do something with a combination of these - but I don't know if the result will truly match what DOS or Windows would expect to see on reboot.
A much easier plan would be to use a chainloading bootloader that can be set to boot in a particular configuration once, like GRUB. You could invoke grub-set-default, then reboot. When GRUB comes up, it would then pass control off to Windows. By then setting the fallback OS to the Linux partition, control would return to Linux on the next boot.
Yet another option may be to use Coreboot, but I'm not sure if this is production-ready for booting windows yet.
i haven't tried this so I don't know if it would work, but here goes:
There is an option in the header of a bzImage format kernel file that specifies the address of real mode code to execute before the protected mode code starts. You could create a minimal bzImage-compliant file which has no actual kernel, but which has real mode code to load your MBR using INT 0x13 to 0x7c00 and jmp into it like the BIOS does.
If you use kexec to load the bzImage using the "-t bzImage-x86 --real-mode" options, it should reset the PE bit in CR0 to drop to realmode (as bdonlan above mentioned) and execute the code pointed to by the bzImage header option.
The bzImage header option is called realmode_swtch and is documented in /usr/src/linux/Documentation/x86/boot.txt , the header format code is in /usr/src/linux/arch/x86/boot/header.S
Have you looked into kexec?

Building a custom Linux Live CD

Can anyone point me to a good tutorial on creating a bootable Linux CD from scratch?
I need help with a fairly specialized problem: my firm sells an expansion card that requires custom firmware. Currently we use an extremely old live CD image of RH7.2 that we update with current firmware. Manufacturing puts the cards in a machine, boots off the CD, the CD writes the firmware, they power off and pull the cards. Because of this cycle, it's essential that the CD boot and shut down as quickly as possible.
The problem is that with the next generation of cards, I have to update the CD to a 2.6 kernel. It's easy enough to acquire a pre-existing live CD - but those all are designed for showing off Linux on the desktop - which means they take forever to boot.
Can anyone fix me up with a current How-To?
Update:
So, just as a final update for anyone reading this later - the tool I ended up using was "livecd-creator".
My reason for choosing this tool was that it is available for RedHat-based distributions like CentOs, Fedora and RHEL - which are all distributions that my company supports already. In addition, while the project is very poorly documented it is extremely customizable. I was able to create a minimal LiveCD and edit the boot sequence so that it booted directly into the firmware updater instead of a bash shell.
The whole job would have only taken an hour or two if there had been a README explaining the configuration file!
There are a couple of interesting projects you could look into.
But first: does it have to be a CD-ROM? That's probably the slowest possible storage (well, apart from tape, maybe) you could use. What about a fast USB stick or a an IEE1394 hard-disk or maybe even an eSATA hard-disk?
Okay, there are several Live-CDs that are designed to be very small, in order to e.g. fit on a business card sized CD. Some were also designed to be booted from a USB stick, back when that meant 64-128 MiByte: Damn Small Linux is one of the best known ones, however it uses a 2.4 kernel. There is a sister project called Damn Small Linux - Not, which has a 2.6 kernel (although it seems it hasn't been updated in years).
Another project worth noting is grml, a Live-CD for system administration tasks. It does not boot into a graphic environment, and is therefore quite fast; however, it still contains about 2 GiByte of software compressed onto a CD-ROM. But it also has a smaller flavor, aptly named grml-small, which only contains about 200 MiByte of software compressed into 60 MiByte.
Then there is Morphix, which is a Live-CD builder toolkit based on Knoppix. ("Morphable Knoppix"!) Morphix is basically a tool to build your own special purpose Live-CD.
The last thing I want to mention is MachBoot. MachBoot is a super-fast Live-CD. It uses various techniques to massively speed up the boot process. I believe they even trace the order in which blocks are accessed during booting and then remaster the ISO so that those blocks are laid out contiguously on the medium. Their current record is less than 6 seconds to boot into a full graphical desktop environment. However, this also seems to be stale.
One key piece of advice I can give is that most LiveCDs use a compressed filesystem called squashfs to cram as much data on the CD as possible. Since you don't need compression, you could run the mksquashfs step (present in most tutorials) with -noDataCompression and -noFragmentCompression to save on decompression time. You may even be able to drop the squashfs approach entirely, but this would require some restructuring. This may actually be slower depending on your CD-ROM read speed vs. CPU speed, but it's worth looking into.
This Ubuntu tutorial was effective enough for me to build a LiveCD based on 8.04. It may be useful for getting the feel of how a LiveCD is composed, but I would probably not recommend using an Ubuntu LiveCD.
If at all possible, find a minimal LiveCD and build up with only minimal stripping out, rather than stripping down a huge LiveCD like Ubuntu. There are some situations in which the smaller distros are using smaller/faster alternatives rather than just leaving something out. If you want to get seriously hardcore, you could look at Linux From Scratch, and include only what you want, but that's probably more time than you want to spend.
Creating Your Own Custom Ubuntu 7.10 Or Linux Mint 4.0 Live-CD With Remastersys
Depends on your distro. Here's a good article you can check out from LWN.net
There is a book I used which covers a lot of distros, though it does not cover creating a flash-bootable image. The book is Live Linux(R) CDs: Building and Customizing Bootables. You can use it with supplemental information from your distro of choice.
So, just as a final update for anyone reading this later - the tool I ended up using was "livecd-creator".
My reason for choosing this tool was that it is available for RedHat-based distributions like CentOs, Fedora and RHEL - which are all distributions that my company supports already. In addition, while the project is very poorly documented it is extremely customizable. I was able to create a minimal LiveCD and edit the boot sequence so that it booted directly into the firmware updater instead of a bash shell.
The whole job would have only taken an hour or two if there had been a README explaining the configuration file!
Debian Live provides the best tools for building a Linux Live CD. Webconverger uses Debian Live for example.
It's very easy to use.
sudo apt-get install live-helper # from Debian unstable, which should work fine from Ubuntu
lh_config # edit config/* to your liking
sudo lh_build

Resources