LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Cloning CentOS Problem - "Could Not Boot" (https://www.linuxquestions.org/questions/linux-newbie-8/cloning-centos-problem-could-not-boot-4175549835/)

hamprop 08-04-2015 02:38 PM

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.

Ztcoracat 08-04-2015 02:53 PM

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)

SpudMan13 08-04-2015 02:55 PM

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

hamprop 08-04-2015 03:10 PM

Thank you both for the quick replies.

Quote:

Originally Posted by SpudMan13 (Post 5400865)
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

Ztcoracat 08-04-2015 05:06 PM

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)

hamprop 08-05-2015 08:34 AM

Quote:

Originally Posted by Ztcoracat (Post 5400899)
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.

Ztcoracat 08-05-2015 02:49 PM

Quote:

Originally Posted by hamprop (Post 5401218)
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.-::-

hamprop 08-05-2015 03:26 PM

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

Ztcoracat 08-05-2015 04:18 PM

Quote:

Originally Posted by hamprop (Post 5401436)
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.

Ztcoracat 08-05-2015 04:23 PM

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?

hamprop 08-05-2015 04:33 PM

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.

Ztcoracat 08-05-2015 04:49 PM

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.-::-

hamprop 08-05-2015 05:05 PM

Quote:

Originally Posted by Ztcoracat (Post 5401477)
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...

Ztcoracat 08-05-2015 05:22 PM

Please post the exact error message.

jefro 08-05-2015 08:01 PM

"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.


All times are GMT -5. The time now is 12:51 AM.