How to display contents of mounted /boot and '/' root partitions?

11,322

Solution 1

Mounting a HDD

To mount a HDD that's physically connected to your system, you first need to identify the device handle that's been assigned to it. I typically use the command line tools blkid or lsblk to find out this information.

blkid
$ sudo blkid
/dev/sda1: UUID="XXXXXX" TYPE="ext4" 
/dev/sda2: UUID="XXXXXX" TYPE="LVM2_member" 
/dev/mapper/fedora_greeneggs-swap: UUID="XXXXXX" TYPE="swap" 
/dev/mapper/fedora_greeneggs-root: UUID="XXXXXX" TYPE="ext4" 
/dev/mapper/fedora_greeneggs-home: UUID="XXXXXX" TYPE="ext4"
lsblk
$ lsblk
NAME                      MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sda                         8:0    0 465.8G  0 disk 
├─sda1                      8:1    0   500M  0 part /boot
└─sda2                      8:2    0 465.3G  0 part 
  ├─fedora_greeneggs-swap 253:0    0   7.7G  0 lvm  [SWAP]
  ├─fedora_greeneggs-root 253:1    0    50G  0 lvm  /
  └─fedora_greeneggs-home 253:2    0 407.6G  0 lvm  /home
sr0                        11:0    1  1024M  0 rom  

So we can see from the above that I've got a ext4 partition on /dev/sda1, and a LVM partition on /dev/sda2. Since you're interested in your /boot device, that's typically formatted as a ext4 partition, so to mount it:

$ sudo mount -r /dev/sda1 /mnt

And it should be accessible to you under /mnt as a read only directory.

Mounting an ISO

If on the other hand you'd like to mount an ISO, you can do so, by using the mount command, along with the loop option.

$ sudo mount -o loop <some.iso> <mount point>
Example
$ sudo mount -o loop VBoxGuestAdditions_4.3.10.iso /mnt/
mount: /dev/loop0 is write-protected, mounting read-only

And you can now see the ISO's contents:

$ ls -l /mnt/
total 57016
dr-xr-xr-x. 2 root root     2048 Mar 26 14:04 32Bit
dr-xr-xr-x. 2 root root     2048 Mar 26 14:04 64Bit
-r-xr-xr-x. 1 root root      647 Oct  8  2013 AUTORUN.INF
-r-xr-xr-x. 1 root root     6966 Mar 26 13:56 autorun.sh
dr-xr-xr-x. 2 root root     2048 Mar 26 14:04 cert
dr-xr-xr-x. 2 root root     2048 Mar 26 14:04 OS2
-r-xr-xr-x. 1 root root     5523 Mar 26 13:56 runasroot.sh
-r-xr-xr-x. 1 root root  9901516 Mar 26 14:01 VBoxLinuxAdditions.run
-r-xr-xr-x. 1 root root 20784640 Mar 26 14:14 VBoxSolarisAdditions.pkg
-r-xr-xr-x. 1 root root 16900432 Mar 26 13:55 VBoxWindowsAdditions-amd64.exe
-r-xr-xr-x. 1 root root   311584 Mar 26 13:46 VBoxWindowsAdditions.exe
-r-xr-xr-x. 1 root root 10463320 Mar 26 13:47 VBoxWindowsAdditions-x86.exe

Solution 2

ls /boot
ls /

… however you might want to expand upon your question, as Debian / SSD drive / live CD are (more or less) irrelevant to listing directory contents. Maybe you're asking where the boot and root partitions from a live CD are mounted, e.g. /mnt/gentoo and /mnt/gentoo/boot?.

Share:
11,322

Related videos on Youtube

Lexx Luxx
Author by

Lexx Luxx

Updated on September 18, 2022

Comments

  • Lexx Luxx
    Lexx Luxx almost 2 years

    How to display contents of mounted /boot and '/' root partitions of Debian on SSD drive from Linux Live CD? I know ls -1 to list directory contents, but what is exact steps to get this?

  • Lexx Luxx
    Lexx Luxx almost 10 years
    Debian on SSD drive not booting, and I want to list contents of these partitions (on SSD drive) using Live CD. How to mount and unmount partitions for this?
  • Lexx Luxx
    Lexx Luxx almost 10 years
    I tried mount command, bit it says "mount: only root can do that"
  • slm
    slm almost 10 years
    @triwo - Correct, you need to prefix it with sudo. I realized I left that out. I added it, sorry about that.
  • Lexx Luxx
    Lexx Luxx almost 10 years
    And unmounting also requires sudo prefix?
  • slm
    slm almost 10 years
    @triwo - correct. Only root can mount/unmount.