LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Remove partition sda5 from disk& edit fstab without losing boot capabilities (https://www.linuxquestions.org/questions/linux-newbie-8/remove-partition-sda5-from-disk-and-edit-fstab-without-losing-boot-capabilities-937818/)

EDDY1 04-03-2012 12:37 AM

Remove partition sda5 from disk& edit fstab without losing boot capabilities
 
Sda 5 /home/previous_os is partition that existed from a previous install,which I backed up to my home partition, I recently deleted it & found my system unbootable.
I tried grub rescue from live-cd & found that I couldn't chroot to make necessary changes, nor, make changes from the grub prompt (inaddiquacies on my part), so, I recently installed anothe debian os & saved home to recover data after retrieving data I would like to remove the new sda5 & maintain my bootable system.
My intentions are to make all necessary changes to fstab &, or grub my google searches have not given me any light upon this matterm (making necessary changes before deleting partition on bootable linux system).
http://www.google.com/search?q=makin...a7a5ae9431d5a8
I have however found this thread but it's for a non-bootable system
http://www.kubuntuforums.net/showthr...-Grub2-related
Any hints as to which way I can proceed with partition removal?

pingu 04-03-2012 01:48 AM

My first guess is that your root-system was on a partition after sda5.
Thing is, logical volumes (as all "partitions" above 4 are) change number if you add / remove partitions in front. Primary partitions don't, they always keep their number.
So if you have let's say sda5, sda6, sda7 and then remove partition sda5 - you end up with partitions sda5, sda6 (being the old sda6 & sda7).
If I'm right, all you need to do is to change a line in grub - could be done during boot.
You change "root=/dev/sda6" (or whatever number it was) to "root=/dev/sda5" (that is, one number lower than before).

If I'm not correct then please give complete partition layout, with info also about actice partition - which partition you boot from.

EDDY1 04-03-2012 08:07 AM

Quote:

My first guess is that your root-system was on a partition after sda5.
Yes , if I save home from previous installation my new install starts at sda6.
Quote:

Thing is, logical volumes (as all "partitions" above 4 are) change number if you add / remove partitions in front. Primary partitions don't, they always keep their number.
Yes the partition #'s changed.
Quote:

So if you have let's say sda5, sda6, sda7 and then remove partition sda5 - you end up with partitions sda5, sda6 (being the old sda6 & sda7).
If I'm right, all you need to do is to change a line in grub - could be done during boot.
At grub rescue prompt I couldn't figure out for the life of me how to proceed. Also my system uses UUID not sure if that makes a difference.
I tried this 1 & command failed at
Quote:

insmod (hdx,y)/boot/grub/linux.mod
I believe the error was command not found.
I 'm attaching my fstab as I plan on doing it again.
Code:

# / was on /dev/sda6 during installation
UUID=0af920e3-852d-429c-b0cb-65fc93c229f7 /              ext4    errors=remount-ro 0      1
# /home was on /dev/sda11 during installation
UUID=62fa9d79-5fe2-420a-913b-e5ddea98231d /home          ext4    defaults        0      2
# /tmp was on /dev/sda10 during installation
UUID=af798ced-4a4d-4e94-9340-44edd54198a6 /tmp            ext4    defaults        0      2
# /usr was on /dev/sda7 during installation
UUID=40a5fc9d-88b1-47e8-9065-f0e0993c198b /usr            ext4    defaults        0      2
# /var was on /dev/sda8 during installation
UUID=fa3b428f-48f7-4f4e-9747-58007571a398 /var            ext4    defaults        0      2
# swap was on /dev/sda9 during installation
UUID=22243b45-cde4-48b5-9ec3-3aaff149b199 none            swap

It doesn't show sda5 which is my /home saved from previous install. Which I'd like to remove.

catkin 04-03-2012 08:25 AM

/sbin/blkid (without any options or arguments) lists /dev/sd* with their UUID strings.

EDIT: including any not listed in fstab

EDDY1 04-03-2012 10:34 PM

Ok after getting data off home partition & deleting again I was able to delete the partition & rescue from the grub prompt using these 2 posts.
http://ubuntuforums.org/showpost.php...12&postcount=3

EDDY1 04-05-2012 01:21 AM

This thread is solved.
After using the above post & especially this 1, the last answer
http://superuser.com/questions/18173...hout-a-live-cd
I was able to recover & edit my /etc/fstab then do a
Quote:

grub install /dev/sda
now the system is bootable
Next item on my list of to do's is to learn how to recover from busy box


All times are GMT -5. The time now is 02:42 PM.