1

Linux embedded file system (Linux v. 2.6.26.5) running on raw NAND flash, it use Full Image's RootFS. U-boot 2009.03 bootloader. I need access shell after the Kernel is fully loaded, so that I can reset password. For now I use busybox emergency shell, so Linux kernel not fully loaded, the root partition is not mounted, not all drivers are loaded and many commands not work. I need mount the root partition, but I don't know exactly what is the real root partition on /dev. Boot log contain some lines,

Kernel command line: console=ttyS1,115200n8 rootfstype=squashfs noalign half_image=0 verify=y

LINUX_ROOTFS is 4
VFS: Mounted root (squashfs filesystem) readonly.
...

I guess root can be /dev/mtdblock5, but not sure. What is correct command to mount the root partition?

mount /dev/mtdblock5 /

Also what is worst case scenario, if I don't guess partition and set it incorrectly?

edit: I tried fdisk

BusyBox v1.10.2 (2017-08-02 14:07:25 CST) built-in shell (ash)
Enter 'help' for a list of built-in commands.

/bin/sh: can't access tty; job control turned off
# fdisk -l 
/bin/sh: fdisk: not found
# 

# mount
mount: no /proc/mounts
#

# lsblk
/bin/sh: lsblk: not found

I managed mount /proc. But can't mount /dev, /sys.

# cd /
# mount -t dev dev /dev
mount: mounting dev on /dev failed: No such device
# mount -t proc proc /proc
# mount -t sys sys /sys
mount: mounting sys on /sys failed: No such device
# mount -t devpts devpts /dev/pts
mount: mounting devpts on /dev/pts failed: No such file or directory
1

For mount the partition the first step is know "where" is:

fdisk -l 

The answer must be something like this:

Disk /dev/sda: 931,5 GiB, 1000204886016 bytes, 1953525168 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: dos
Disk identifier: 0x00009971

Device     Boot     Start        End    Sectors   Size Id Type
/dev/sda1            2048   10547199   10545152     5G 82 Linux swap / Solaris
/dev/sda2       192243712 1953521663 1761277952 839,9G  7 HPFS/NTFS/exFAT
/dev/sda3  *     10547200  192243711  181696512  86,7G 83 Linux

In the last section you can see "where" are the partitions! Only rest mount them, with the comand you propose: "mount" (obviously :-) )

For the second question: I don't think you will broke something...in the worst scenario the prompt will give you an error.

Greetings

  • I already tried fdisk, please see edit. – triwo Nov 29 '17 at 23:28
0

Sorry for the late answer, I only have internet in my work.

So, you can use lsblk instead fdisk, here are the results:

root@CyborgPC /h/cyborg# lsblk 
NAME   MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sda      8:0    0 931,5G  0 disk 
├─sda1   8:1    0     5G  0 part [SWAP]
├─sda2   8:2    0 839,9G  0 part 
└─sda3   8:3    0  86,7G  0 part /
sr0     11:0    1  1024M  0 rom  

As you can see the sda2 partition is not mounted, I mount:

root@CyborgPC /h/cyborg# mount /dev/sda2 /media/cyborg/Almacen

And use the lsblk again:

root@CyborgPC /h/cyborg# lsblk 
NAME   MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sda      8:0    0 931,5G  0 disk 
├─sda1   8:1    0     5G  0 part [SWAP]
├─sda2   8:2    0 839,9G  0 part /media/cyborg/Almacen
└─sda3   8:3    0  86,7G  0 part /
sr0     11:0    1  1024M  0 rom 

As you can see the lsblk give you the path where the device is found in /dev and, if it's mounted, give you the localization.

Hope you can solve your problem.

  • I mounted /proc. But can't mount /dev, /sys. I need also mount root partition, its mtd4 ("LINUX_ROOTFS"). – triwo Nov 30 '17 at 23:31
  • But are you trying to mount the partitions of the device in the same folders of yours partitions? First create a folder: mkdir -p /new_folder Then mount in that new folder the partition: mount /dev/partition_number /new_folder – k.Cyborg Dec 1 '17 at 21:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.