Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[Solved] Want to change root filesystem
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Installing Gentoo
View previous topic :: View next topic  
Author Message
The_Document
Apprentice
Apprentice


Joined: 03 Feb 2018
Posts: 272

PostPosted: Fri Feb 23, 2018 10:23 pm    Post subject: [Solved] Want to change root filesystem Reply with quote

I want to change my rootfs to another filesystem but I am uncertain what actually tells the system what partition is root. Currently root is sda4, also if I make another partition (/dev/sda5) then delete sda4 will it automatically be renamed sda5 to sda4? Since I don't want to delete old partition until new one works, what must be modified to use new partition sda5 as the root partition?

Last edited by The_Document on Sat Feb 24, 2018 7:02 am; edited 1 time in total
Back to top
View user's profile Send private message
eccerr0r
Watchman
Watchman


Joined: 01 Jul 2004
Posts: 7134
Location: almost Mile High in the USA

PostPosted: Sat Feb 24, 2018 1:07 am    Post subject: Reply with quote

It depends on what you set in your bootloader. It's good to be suspicious that things may break if you simply deleted partitions, you're right.

Your bootloader config may be simply using labels or UUID to find your root partition, but even so I would not suggest forging your new partition to the same label/UUID (and renaming your old partition); plus if it's PARTUUID it wouldn't help.

If you're using grub2, you could check/edit your /boot/grub/grub.cfg or wherever it's located for your machine.
_________________
Intel Core i7 2700K@ 4.1GHz/HD3000 graphics/8GB DDR3/180GB SSD
What am I supposed watching?
Back to top
View user's profile Send private message
The_Document
Apprentice
Apprentice


Joined: 03 Feb 2018
Posts: 272

PostPosted: Sat Feb 24, 2018 1:18 am    Post subject: Reply with quote

eccerr0r wrote:
It depends on what you set in your bootloader. It's good to be suspicious that things may break if you simply deleted partitions, you're right.

Your bootloader config may be simply using labels or UUID to find your root partition, but even so I would not suggest forging your new partition to the same label/UUID (and renaming your old partition); plus if it's PARTUUID it wouldn't help.

If you're using grub2, you could check/edit your /boot/grub/grub.cfg or wherever it's located for your machine.


I looked into grub.cfg and it seems to be using IDs Im not really sure.
grub.cfg
https://paste.pound-python.org/show/LegWhMim8Be7Ufe1VDOx/

fdisk-l
https://paste.pound-python.org/show/x98tLQmN5J1kL1nIe9hH/
I don't know why sda4 has microsoft type in it.

The handbook has nothing mentioning specifying partition for root use

https://wiki.gentoo.org/wiki/Handbook:AMD64/Installation/Bootloader

Question is, isn't there a way to issue a grub command speciftying root partition so the command generates a new grub.cfg accordingly?
Back to top
View user's profile Send private message
Tony0945
Advocate
Advocate


Joined: 25 Jul 2006
Posts: 3100
Location: Illinois, USA

PostPosted: Sat Feb 24, 2018 1:25 am    Post subject: Re: Want to change root filesystem Reply with quote

The_Document wrote:
Currently root is sda4, also if I make another partition (/dev/sda5) then delete sda4 will it automatically be renamed sda5 to sda4? Since I don't want to delete old partition until new one works, what must be modified to use new partition sda5 as the root partition?

Yes, on the delete. but if your partition scheme is MBR you can only have four primary partitions. If it's GPT, you can.
Rather than create and delete partitions, I would do the following (and I have in the past):

1. Boot with alternate media like sysrescuecd, Knoppix et al.
2. tar up the root partition onto another hard drive or a spare partition if there is enough room. An external USB drive will do and also serve as a backup.
compression is optional, depending on space or computer power.
3. reformat the partition using tools on the CD (sysrescucd is ideal for this).
4. untar the backup onto the original partition. As a bonus, all files will be defragmented.
Now you only have to reboot provided that your kernel supports the new filesystem type as built-in. If not, chroot into the partition and fix the kernel.

What decides which partition is root? Well one way is by kernel command line. As in this line from grub legacy:
Code:
kernel /boot/kernel-genkernel-x86-3.8.13-gentoo root=/dev/sda3
I'm told that absent a parameter the kernel assumes that the partition that it is on is the root partition, hence the need for a "root=" if /boot is on a separate partition. I do have one system without command line parameters and sure enough /boot is just a directory on the root partition.
Back to top
View user's profile Send private message
eccerr0r
Watchman
Watchman


Joined: 01 Jul 2004
Posts: 7134
Location: almost Mile High in the USA

PostPosted: Sat Feb 24, 2018 1:40 am    Post subject: Reply with quote

Actually it does look like it is specifying hardcoded partitions in your grub.cfg
boot.cfg wrote:
Code:
   echo   'Loading Linux 4.15.4-gentoo ...'
   linux   /vmlinuz-4.15.4-gentoo root=/dev/sda4 ro 


What you should do:

1. Boot normally to grub. Now instead of letting it fully go to boot, go to the option you normally boot with, hit 'e' for edit. Go and edit the root=/dev/sda4 to root=/dev/sda5 and see if it will boot.

2. Once you verify it boots, go ahead and use grub-mkconfig again, and before you overwrite your old boot.cfg, inspect that it has root=your new partition. Grub-mkconfig should notice your root partition is now /dev/sda5 and should create it with /dev/sda5 as the default root.

Another option is that you could copy and paste the menuoption clause and have two option to specify each of the partitions, but not sure if you even want that - just saying, there's a lot of possibilities out there!
_________________
Intel Core i7 2700K@ 4.1GHz/HD3000 graphics/8GB DDR3/180GB SSD
What am I supposed watching?


Last edited by eccerr0r on Sat Feb 24, 2018 1:44 am; edited 1 time in total
Back to top
View user's profile Send private message
The_Document
Apprentice
Apprentice


Joined: 03 Feb 2018
Posts: 272

PostPosted: Sat Feb 24, 2018 1:43 am    Post subject: Reply with quote

eccerr0r wrote:
Actually it does look like it is specifying hardcoded partitions in your grub.cfg
boot.cfg wrote:
Code:
   echo   'Loading Linux 4.15.4-gentoo ...'
   linux   /vmlinuz-4.15.4-gentoo root=/dev/sda4 ro 


What you should do:

1. Boot normally to grub. Now instead of letting it fully go to boot, go to the option you normally boot with, hit 'e' for edit. Go and edit the root=/dev/sda4 to root=/dev/sda5 and see if it will boot.

2. Once you verify it boots, go ahead and use grub-mkconfig again, and before you overwrite your old boot.cfg, inspect that it has root=your new partition.


Thanks for the advice, general question - are new UUID provided to only new partitions, or also to partitions which were formated to a different filesystem? It seems like there would be no reason to provide a new UUID just for a format but Im not sure.
Back to top
View user's profile Send private message
eccerr0r
Watchman
Watchman


Joined: 01 Jul 2004
Posts: 7134
Location: almost Mile High in the USA

PostPosted: Sat Feb 24, 2018 1:45 am    Post subject: Reply with quote

Each time you mkfs a partition, a new UUID is created for it. However your old grub.cfg is pointing linux to the partition by a /dev/sda4 - not uuid.

The grub.cfg might be confusing at it itself is using UUIDs for it to keep itself straight. But it's not using them to tell the kernel what partition to use as root.
_________________
Intel Core i7 2700K@ 4.1GHz/HD3000 graphics/8GB DDR3/180GB SSD
What am I supposed watching?
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Installing Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum