PDA

View Full Version : Any way to mount and chroot a entire hard drive?



sk545
02-23-2004, 12:30 AM
For example, i have this right now:


Device Boot Start End Blocks Id System
/dev/hda1 * 1 853 6851691 7 HPFS/NTFS
/dev/hda2 854 7860 56283727+ c W95 FAT32 (LBA)
/dev/hda3 7861 14946 56918295 5 Extended
/dev/hda5 7861 12115 34178256 83 Linux
/dev/hda6 12116 14824 21760011 83 Linux
/dev/hda7 14825 14946 979933+ 82 Linux swap


Am i able to do the following after booting from the knoppix cd?:

% mount /dev/hda /mnt/hda5
% chroot /mnt/hda5

I did try it, but i get some kind of 'bad superblocks or too many filesystems mounted error'.

I am able to mount partitions separately and chroot into them, like /dev/hda5, or /dev/hda6. Was wondering if i could do the whole drive as /dev/hda.

Thanks.

/edit: a thought just occured to me. It might be because of the windows partitions that it won't let me mount the whole drive. Am i right?

boudie
02-23-2004, 10:03 PM
/dev/hda is not a partition
/dev/hda5 is a partition
mount /dev/hda5
Or more properly, as root:
mount -t reiserfs /dev/hda5 /mnt/hda5
Replace filesystem type and mount point with
whatever is applicable to your system (/etc/fstab)
Once mounted, you can chroot into it.
Didn't you try clicking on the icon first?
Much simpler.

Rootman
02-24-2004, 12:35 AM
For example, i have this right now:


Device Boot Start End Blocks Id System
/dev/hda1 * 1 853 6851691 7 HPFS/NTFS
/dev/hda2 854 7860 56283727+ c W95 FAT32 (LBA)
/dev/hda3 7861 14946 56918295 5 Extended
/dev/hda5 7861 12115 34178256 83 Linux
/dev/hda6 12116 14824 21760011 83 Linux
/dev/hda7 14825 14946 979933+ 82 Linux swap


Am i able to do the following after booting from the knoppix cd?:

% mount /dev/hda /mnt/hda5
% chroot /mnt/hda5

I did try it, but i get some kind of 'bad superblocks or too many filesystems mounted error'.

I am able to mount partitions separately and chroot into them, like /dev/hda5, or /dev/hda6. Was wondering if i could do the whole drive as /dev/hda.

Thanks.

/edit: a thought just occured to me. It might be because of the windows partitions that it won't let me mount the whole drive. Am i right?

You are right in thinking /dev/hda is the ENTIRE drive but it cannot be mounted, only the filesystems under it.

In order to accomplish thiis you should mount the filesystem that holds the Linux system you are changing to - which looks like maybe it's /dev/hda5. Make sure you mount /dev/hda5 as a RW partition on the base system, chroot to it (i.e. chroot /mnt/hda5).

Now modify the chrooted Linux systems /etc/fstab file to mount the partitions under the new chrooted environment and issue the command
mount -aThis will mount all the partitions listed in the chrooted Linux's /etc/fstab.

sk545
02-24-2004, 07:58 PM
thx all.