How to list the files and folders inside a partition
By John Parsons •
I made a backup of my home directory to a new partition that i created /sdb1. Now I want to check if the files and folders of my home directory are actually copied in the partition. I noticed that I can not cd in the partition and ls its contents. How can I do something like that?
sudo mount -t ext4 /dev/sdb1 /mnt
sudo dump -0 -f /dev/sdb1 ~
ls /dev/sdb1Another thing that happens here is that sdb1 after executing dump appears to be unformated.
62 Answers
After you mounted /dev/sdb1 on /mnt, you must check the existence of the file inside /mnt
ls /mnt Here's what I understand. Please correct me if I'm mistaken.
- Most programs operate at the filesystem level, where data structures are files and metadata
dump, likedd, operates at the device level, where there are no data structures, just binary./dev/sdb1is a device, not a directory, so you need to mount it to make it accessible for programs that operate at the filesystem level.
So, to do what you want, you need to operate on the mountpoint, not the device:
sudo mount /dev/sdb1 /mnt # Mount the device to the mountpoint.
cd /mnt # Now you can cd, use ls, or read the files