Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I'm fairly new to the Linux world, and I'm in the process of setting up a web server. I'm running CentOS 7 on an older machine, and have gotten most of it figured out.
When the original hard drive was cloned onto another drive as a backup, problems began to arise. Currently, I have the backup in the machine, and when I boot it up, I get the following error:
Code:
[ OK ] Started File System Check on /dev/mapper/centos-root.
dracut-initqueue[257]: Warning: Could not boot.
dracut-initqueue[257]: Warning: /dev/centos/swap does not exist
Starting Dracut Emergency Shell...
Warning: /dev/centos/swap does not exist
Generating "/run/initramfs/rdsosreport.txt"
When I exit out of emergency mode by typing "exit" the system boots normally after sometime, with "A start job is running for dev-mapper-centos\x2dswap.device".
Once that is complete, system is booted up fine.
I understand that the issue is related to the cloned backup, but fail to understand why, or how to fix it. Any advice would be greatly appreciated.
It looks like you were able to successfully copy the data over to the new (backup) drive, but it looks like the swap partition was not copied over.
You can look at the partitioning of the original disk with "fdisk -l".
From you description, you will need to create a swap partition on the new disk using "fdisk". If you're not familiar with it, be sure to read up on it, as you can inadvertently overwrite data.
Alternatively, you can make a swap file:
Create New Swap Partition:
- mkdir /swapfile
- cd /swapfile
- dd if=/dev/zero of=/swapfile/swap01 bs=1M count=4096
- mkswap /swapfile/swap01
- chmod 0600 /swapfile/swap01
- vi /etc/fstab
> /swapfile/swap01 swap swap defaults 0 0
- mount -a
- swapon -a
- swapon -s
It looks like you were able to successfully copy the data over to the new (backup) drive, but it looks like the swap partition was not copied over.
You can look at the partitioning of the original disk with "fdisk -l".
From you description, you will need to create a swap partition on the new disk using "fdisk". If you're not familiar with it, be sure to read up on it, as you can inadvertently overwrite data.
Alternatively, you can make a swap file:
Create New Swap Partition:
- mkdir /swapfile
- cd /swapfile
- dd if=/dev/zero of=/swapfile/swap01 bs=1M count=4096
- mkswap /swapfile/swap01
- chmod 0600 /swapfile/swap01
- vi /etc/fstab
> /swapfile/swap01 swap swap defaults 0 0
- mount -a
- swapon -a
- swapon -s
I think I will simply go about creating a swap file. Thank you for the steps needed to create a swap file, I imagine the steps aren't too different from the following tutorial? If so, I will be following those steps as to better understand why they are taken.
That article in the link you posted, the instructions are similar.
I would just follow SpudMan13 instruction in post #3 and create a swap file. (it's up to you though)
I Should have simply followed SpudMan13's advice and avoided that tutorial. It seems due to the file system I've chosen, fallocate causes problems, and at a particular step, I get a "Invalid argument" output.
With that being said, and after a little reading as to why each step is taken, I'm following SpudMan13's steps. I'm currently in vi editor, and I'm not sure what the next step is in adding an fstab entry. Am I to hit 'i', to get into insert mode, then type "> /swapfile/swap01 swap swap defaults 0 0" without the quotes, on the first line? this is what I understand it as.
I Should have simply followed SpudMan13's advice and avoided that tutorial. It seems due to the file system I've chosen, fallocate causes problems, and at a particular step, I get a "Invalid argument" output.
With that being said, and after a little reading as to why each step is taken, I'm following SpudMan13's steps. I'm currently in vi editor, and I'm not sure what the next step is in adding an fstab entry. Am I to hit 'i', to get into insert mode, then type "> /swapfile/swap01 swap swap defaults 0 0" without the quotes, on the first line? this is what I understand it as.
Yes, while in Vi press the 'i' key in order to add to that file what you need to.
Yes, w/o the quotes.
Put this in that fstab file:
Code:
>/swapfile/swap01 swap swap defaults 0 0
- mount -a
- swapon -a
- swapon -s
When finished press the ESC key and than hold down the shift key and type zz.
That should save your changes.
If not you can use nano to edit that file.
-::-Whatever you did in that tutorial can be undone.-::-
Last edited by Ztcoracat; 08-05-2015 at 02:53 PM.
Reason: Add symbols
After adding the fstab entry, and going to the following steps (swapon -a), I got an invalid entry. I imagined this may be due to the fact that I created a previous swapfile entry in fstab from the previous tutorial.
I then went back into the fstab file, and added an hashtag in front of the initial /swapfile entry from the previous tutorial.
After adding the fstab entry, and going to the following steps (swapon -a), I got an invalid entry. I imagined this may be due to the fact that I created a previous swapfile entry in fstab from the previous tutorial.
I then went back into the fstab file, and added an hashtag in front of the initial /swapfile entry from the previous tutorial.
I'm only using 50 of my root partition, and 1 of my home partition, so plenty of space. I'd actually prefer to do it this way, as to better familiarise myself with the process, and to learn as much as possible.
"When I exit out of emergency mode by typing "exit" the system boots normally after sometime, with "A start job is running for dev-mapper-centos\x2dswap.device".
Once that is complete, system is booted up fine."
I've still been wondering about this. I almost can't believe it would work like that.
Wonder if looking at dmsetup is a way to proceed also.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.