LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This 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


Reply
  Search this Thread
Old 08-04-2015, 02:38 PM   #1
hamprop
LQ Newbie
 
Registered: Aug 2015
Posts: 13

Rep: Reputation: Disabled
Cloning CentOS Problem - "Could Not Boot"


Hey,

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.
 
Old 08-04-2015, 02:53 PM   #2
Ztcoracat
LQ Guru
 
Registered: Dec 2011
Distribution: Slackware
Posts: 7,473
Blog Entries: 10

Rep: Reputation: Disabled
Hi:

It looks like your system can not find the swap partition.

https://www.centos.org/forums/viewto...p?f=47&t=52140

Is there a chance that you have a CentOS Live CD? (to chroot)
 
Old 08-04-2015, 02:55 PM   #3
SpudMan13
LQ Newbie
 
Registered: Jul 2015
Posts: 8

Rep: Reputation: Disabled
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
 
Old 08-04-2015, 03:10 PM   #4
hamprop
LQ Newbie
 
Registered: Aug 2015
Posts: 13

Original Poster
Rep: Reputation: Disabled
Thank you both for the quick replies.

Quote:
Originally Posted by SpudMan13 View Post
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.

https://www.digitalocean.com/communi...ap-on-centos-7

Last edited by hamprop; 08-04-2015 at 03:18 PM.
 
Old 08-04-2015, 05:06 PM   #5
Ztcoracat
LQ Guru
 
Registered: Dec 2011
Distribution: Slackware
Posts: 7,473
Blog Entries: 10

Rep: Reputation: Disabled
Your Welcome.

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)
 
Old 08-05-2015, 08:34 AM   #6
hamprop
LQ Newbie
 
Registered: Aug 2015
Posts: 13

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by Ztcoracat View Post
Your Welcome.

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.
 
Old 08-05-2015, 02:49 PM   #7
Ztcoracat
LQ Guru
 
Registered: Dec 2011
Distribution: Slackware
Posts: 7,473
Blog Entries: 10

Rep: Reputation: Disabled
Quote:
Originally Posted by hamprop View Post
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
 
1 members found this post helpful.
Old 08-05-2015, 03:26 PM   #8
hamprop
LQ Newbie
 
Registered: Aug 2015
Posts: 13

Original Poster
Rep: Reputation: Disabled
I'm still getting that error prompt.

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.

My fstab file looks like this currently:

Code:
/dev/mapper/centos-root / xfs defaults 0 0
UUID=cb1bc9c7... /boot xfs defaults 0 0
/dev/mapper/centos-home /home xfs defaults 0 0 
#/dev/mapper/centos-swap swap swap defaults 0 0
/swapfiles/swap01 swap swap defailts 0 0
What did I do wrong in this case?

EDIT:

I ran the fdisk -l command, and there is no /swap entry as compared to my original disk.

And in regards to undoing what I did in the previous tutorial, I imagine I have to do the following, and please, correct me if I'm wrong:

Delete the fstab entry completely
Then, as root,
Code:
rm /swapfile

Last edited by hamprop; 08-05-2015 at 04:00 PM.
 
Old 08-05-2015, 04:18 PM   #9
Ztcoracat
LQ Guru
 
Registered: Dec 2011
Distribution: Slackware
Posts: 7,473
Blog Entries: 10

Rep: Reputation: Disabled
Quote:
Originally Posted by hamprop View Post
I'm still getting that error prompt.

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.

My fstab file looks like this currently:

Code:
/dev/mapper/centos-root / xfs defaults 0 0
UUID=cb1bc9c7... /boot xfs defaults 0 0
/dev/mapper/centos-home /home xfs defaults 0 0 
#/dev/mapper/centos-swap swap swap defaults 0 0
/swapfiles/swap01 swap swap defailts 0 0
What did I do wrong in this case?

EDIT:

I ran the fdisk -l command, and there is no /swap entry as compared to my original disk.

And in regards to undoing what I did in the previous tutorial, I imagine I have to do the following, and please, correct me if I'm wrong:

Delete the fstab entry completely
Then, as root,
Code:
rm /swapfile
You for got to add the last 4 lines on the page of post #3 to your /etc/fstab file.
Copy and paste those last 4 lines and add them to your file.

No, don't delete or remove the swapfile.

Running fdisk -l is not going to show you a swap partition because your creating a swap file instead.

If you want to create a swap partition you would have to have at least 1 GB to do so and use gparted to do it.
 
Old 08-05-2015, 04:23 PM   #10
Ztcoracat
LQ Guru
 
Registered: Dec 2011
Distribution: Slackware
Posts: 7,473
Blog Entries: 10

Rep: Reputation: Disabled
If editing that file is hard to understand you could download Gparted Live and use it to create a swap partition.
http://gparted.org/livecd.php

If I remember correctly you don't have much in the way of free space left over to use, do you?
 
Old 08-05-2015, 04:33 PM   #11
hamprop
LQ Newbie
 
Registered: Aug 2015
Posts: 13

Original Poster
Rep: Reputation: Disabled
So I'm changing my fstab file to look exactly as follows?

Code:
/dev/mapper/centos-root / xfs defaults 0 0
UUID=cb1bc9c7... /boot xfs defaults 0 0
/dev/mapper/centos-home /home xfs defaults 0 0 
#/dev/mapper/centos-swap swap swap defaults 0 0
/swapfiles/swap01 swap swap defailts 0 0
mount -a
swapon -a
swapon -s
And sorry, you'll have to excuse my ignorance.

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.

Last edited by hamprop; 08-05-2015 at 04:40 PM.
 
Old 08-05-2015, 04:49 PM   #12
Ztcoracat
LQ Guru
 
Registered: Dec 2011
Distribution: Slackware
Posts: 7,473
Blog Entries: 10

Rep: Reputation: Disabled
Yes just like that but you spelled "defailts" wrong in this line. (*defaults*)

Code:
/swapfiles/swap01 swap swap defailts 0 0
Quote:
I'd actually prefer to do it this way, as to better familiarise myself with the process, and to learn as much as possible.
I understand and respect that.-
-::-Take your time when you edit your files.-::-
 
Old 08-05-2015, 05:05 PM   #13
hamprop
LQ Newbie
 
Registered: Aug 2015
Posts: 13

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by Ztcoracat View Post
Yes just like that but you spelled "defailts" wrong in this line. (*defaults*)

Code:
/swapfiles/swap01 swap swap defailts 0 0

I understand and respect that.-
-::-Take your time when you edit your files.-::-
Heh, yeah, just caught that. Luckily, that was just an error with me typing it up here- it's fine in the actual fstab file.

With that being said, my fstab file looks EXACTLY like how I've posted above (without the error), yet on reboot, I've gotten the exact same error...
 
Old 08-05-2015, 05:22 PM   #14
Ztcoracat
LQ Guru
 
Registered: Dec 2011
Distribution: Slackware
Posts: 7,473
Blog Entries: 10

Rep: Reputation: Disabled
Please post the exact error message.
 
Old 08-05-2015, 08:01 PM   #15
jefro
Moderator
 
Registered: Mar 2008
Posts: 16,381

Rep: Reputation: 2383Reputation: 2383Reputation: 2383Reputation: 2383Reputation: 2383Reputation: 2383Reputation: 2383Reputation: 2383Reputation: 2383Reputation: 2383Reputation: 2383
"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.

Last edited by jefro; 08-05-2015 at 08:03 PM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
CentOS 7 "Failed to load SELinux policy. Freezing" = no boot butchrappe Linux - General 4 05-20-2015 07:50 PM
Centos Server Failed @ Bootup: Missing "/sbin/blkid" & "fsck" command not found beagle7 Linux - Newbie 4 08-24-2012 01:33 AM
"Difference between centos and slackware" and "also how to install scratch on centos" vijayendra.uppalapati Slackware 4 07-12-2012 11:10 PM
"Difference between centos and slackware" and "also how to install scratch on centos" vijayendra.uppalapati Slackware 2 01-23-2011 03:14 AM
Debian Boot Up Problem - stuck at "BR" & "I" jc70417 Debian 2 08-30-2005 04:36 PM


All times are GMT -5. The time now is 10:29 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration