How to display contents of mounted
'/' 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?
How to display contents of mounted
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
lsblk to find out this information.
$ 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 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
$ sudo mount -o loop <some.iso> <mount point>
$ 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
I tried mount command, bit it says "mount: only root can do that" Sep 18, 2014 at 15:16
@triwo - Correct, you need to prefix it with
sudo. I realized I left that out. I added it, sorry about that.– slm ♦Sep 18, 2014 at 15:17
And unmounting also requires
sudoprefix? Sep 18, 2014 at 17:00
@triwo - correct. Only root can mount/unmount.– slm ♦Sep 18, 2014 at 17:01
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.
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? Sep 17, 2014 at 22:07
If the files you want to look at are in an ISO, mount the ISO in Windows as a Virtual CD. Once you use the LiveCD as an installer, you cannot view the filesystem as the contents are extracted to RAM or /tmp (still in RAM) and then mounted as
boot, thanks to the SqushFS. Note that viewing the mounted ISO in Windows will show squashfs as a file, although you can't see what is in it.