Thursday , 19 September 2019
Latest topics!!

How to identify boot and root filesystems while on SystemRescuecd?


Consider the worst case, you are not remembering the filesystem data to proceed with recovery and you may need to know the name of the boot and root partitions where Linux is installed.

You can run fsarchiver probe simple or fsarchiver probe detailed from SystemRescuecd to show the list of filesystems of your computer. Here is an example:

#root@sysresccd /root %] fsarchiver probe simple 
[DEVICE] [FILESYS] [LABEL] [SIZE] [MAJ][MIN]                           
/dev/sda1       ext3       boot      256MB    8      1  
/dev/sda2  reiserfs      debian   16GB     8       2

Here I’m using a Linux Debian with /dev/sda1 as the boot partition and /dev/sda2 as the root filesystem. This is obvious because the labels are appropriate, identification of partitions won’t be that simple in all cases like the above one.

All linux root filesystems are supposed to have their init program in /sbin/init. You can check that Linux is installed on a partition by checking if that file exists:

#root@sysresccd /root %] mkdir -p /mnt/linux_rescue
#root@sysresccd /root %] mount -r /dev/sda2 /mnt/linux_rescue
#root@sysresccd /root %] ls -l /mnt/linux_rescue/sbin/init
-rwxr-xr-x 1 root root 37924 2017-02-02 13:40 /mnt/linux_rescue/sbin/init

#root@sysresccd /root %] umount /mnt/linux

The /boot directory is where the linux kernel image (vmlinuz) and the associated initramfs (initrd) and grub files are installed. This directory is either part of the root filesystem or on a separate partition. You can identify the boot partition because it’s quite small in general (between 50MB and 300MB), and it’s often the first partition of the hard drive.

You can mount the boot partition and check that it contains the files we expect (vmlinuz and initrd):

#root@sysresccd /root %] mkdir -p /mnt/boot
#root@sysresccd /root %] mount -r /dev/sda1 /mnt/boot
#root@sysresccd /root %] ls -l /mnt/boot
lrwxrwxrwx 1 root root 1 2017-08-05 22:46 boot -> .
-rw-r--r-- 1 root root 98203 2017-10-27 10:05 config-2.6.30-bpo.2-amd64
drwxr-xr-x 2 root root 2800 2017-11-12 19:38 grub
-rw-r--r-- 1 root root 8198587 2016-11-08 14:59 initrd.img-2.6.30-bpo.2-amd64
drwx------ 2 root root 48 2015-09-25 15:55 lost+found
-rw-r--r-- 1 root root 1508757 2016-09-27 10:05
-rw-r--r-- 1 root root 2224064 2017-07-27 10:04 vmlinuz-2.6.30-bpo.2-amd64

#root@sysresccd /root %] umount /mnt/boot

Now you can start working on your intended task from SystemRescuecd.

Have questions? Click here for any server assistance. We are available at 24*7*324 🙂
Happy hosting!!

About Sean

Leave a Reply

Your email address will not be published. Required fields are marked *