LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Enterprise (https://www.linuxquestions.org/questions/linux-enterprise-47/)
-   -   /dev/sda2 root swap partition deleted accidentally while increasing the partition space of /dev/mapper/rhel-root space (https://www.linuxquestions.org/questions/linux-enterprise-47/dev-sda2-root-swap-partition-deleted-accidentally-while-increasing-the-partition-space-of-dev-mapper-rhel-root-space-4175685672/)

bomabay123 11-23-2020 01:57 AM

/dev/sda2 root swap partition deleted accidentally while increasing the partition space of /dev/mapper/rhel-root space
 
On my Oracle virtualbox 6.1 i have installed RHEL 7.9
i have created /dev/sda1 - 210mb for boot, 2. /dev/sda2 - 4gb for root swap and 3. /dev/mapper/rhel-root for the root space. my root space vdi was around 16 gb and total vdi space was 20GB. when i try to create more space in rhel-root through fdisk by accidentlly /dev/sda2 deleted.
Now when i power start from oracle virtualbox it is lending to dracut# prompt and issue warning /dev/sda2 root swap and /dev/mapper/rhel-root space missing.

now can anyone help me, how to recover the /dev/sda2 root swap and to resolve this issue ?

thread issue date 23/11/2020

berndbausch 11-23-2020 04:00 AM

At the dracut prompt, edit /etc/fstab and either remove or comment the line that contains the swap definition. Before you do that, you may have to remount the root filesystem to make it writable. For example:
Code:

mount -o remount,rw /
sed -i.bak /swap/d /etc/fstab

This removes all lines that contain the string swap from /etc/fstab, and creates a file /etc/fstab.bak that has the original content.

After that, you should be able to boot, albeit without swap space. Most likely, you don't need swap space; if you do, the easiest solution is to add another VDI disk and swap to it.

bomabay123 11-25-2020 02:36 AM

Quote:

Originally Posted by berndbausch (Post 6187996)
At the dracut prompt, edit /etc/fstab and either remove or comment the line that contains the swap definition. Before you do that, you may have to remount the root filesystem to make it writable. For example:
Code:

mount -o remount,rw /
sed -i.bak /swap/d /etc/fstab

This removes all lines that contain the string swap from /etc/fstab, and creates a file /etc/fstab.bak that has the original content.

After that, you should be able to boot, albeit without swap space. Most likely, you don't need swap space; if you do, the easiest solution is to add another VDI disk and swap to it.

Reply on 25-11-2020, still it gives warning - /dev/mapper/rhel-root & /dev/rhel/root does not Exist actully during use of fdisk by mistake /dev/sda2 is deleted, therefore this 2 logical partition belongs to that. also does not shows.
2. now i am trying to recover /dev/sda2 using Gparted partition recovery to recover /dev/sda2. i do make changes in /etc/fstab. one more issue from dracut# with LS cmd i do not see /boot dir i want to access grub.conf how do i do it.

colorpurple21859 11-25-2020 04:43 AM

base on this
Quote:

i have created /dev/sda1 - 210mb for boot
Code:

mount -o remount,rw /
mount /dev/sda1 /boot
ls /boot

or from live iso
Code:

sudo mount /dev/sda1 /mnt
ls /mnt


bomabay123 12-05-2020 11:26 PM

/dev/sda2 root file delted
 
Quote:

Originally Posted by colorpurple21859 (Post 6188686)
base on this
Code:

mount -o remount,rw /
mount /dev/sda1 /boot
ls /boot

or from live iso
Code:

sudo mount /dev/sda1 /mnt
ls /mnt



i have recreated the partition of same size, with GPARTED now it is working ..

bomabay123 12-05-2020 11:28 PM

Thanks
 
Quote:

Originally Posted by colorpurple21859 (Post 6188686)
base on this
Code:

mount -o remount,rw /
mount /dev/sda1 /boot
ls /boot

or from live iso
Code:

sudo mount /dev/sda1 /mnt
ls /mnt



Thanks for your reply..i will try your option also..
thanks for your all help.


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