Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
mounting a file as a filesystem
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo
View previous topic :: View next topic  
Author Message
holyspirit82
n00b
n00b


Joined: 12 Apr 2021
Posts: 20

PostPosted: Mon Jan 03, 2022 11:38 pm    Post subject: mounting a file as a filesystem Reply with quote

I have a file under /run/Jesus/Jesus and im trying to mount it to /run/Jesus directory as ext3

im doing

Code:

mount -t ext3 -o loop /run/Jesus/Jesus /run/Jesus


but i get this error
Code:

mount: /run/Jesus: wrong fs type, bad option, bad superblock on /dev/loop0, missing codepage or helper program, or other error.

ive installed cifs-utils and lsmod | grep loop shows that loop is there can anyone help
Back to top
View user's profile Send private message
transpetaflops
Apprentice
Apprentice


Joined: 16 May 2005
Posts: 159

PostPosted: Tue Jan 04, 2022 12:02 am    Post subject: Reply with quote

Before addressing the actual error, I'd like to draw your attention to a couple of other potential problems:

Your file is stored in the /run filesystem which is normally a tmpfs filesystem, i.e. a RAM-disk. That file will not survive a power cycle and it will allocate your RAM. I suggest you move it to your SDD/HDD.

Also, you're trying to mount the file in the folder containing the said file. You will probably, at some point, get an error message from mount telling you that the mount point isn't empty. I suggest you create a folder called /mnt/Jesus and keep it empty for this purpose.

Now to your actual error. You haven't shared any details of the contents of this file but I assume it's a complete disk image rather than an image of a single partition? You have to perform some additional commands to make it work.

1) Read the partition table from the image with "fdisk -l /run/Jesus/Jesus"

2) Identify the partition containing the filesystem you want to mount and make note of the start sector

3) Mount that partition with "mount -o loop,offset=$((nnn * 512)) /run/Jesus/Jesus /mnt/Jesus". Replace nnn with the start sector from step 2. The "512" is the sector size and should match the output from fdisk in step 1.
Back to top
View user's profile Send private message
Hu
Moderator
Moderator


Joined: 06 Mar 2007
Posts: 21624

PostPosted: Tue Jan 04, 2022 2:17 am    Post subject: Reply with quote

transpetaflops wrote:
Also, you're trying to mount the file in the folder containing the said file. You will probably, at some point, get an error message from mount telling you that the mount point isn't empty.
mount will allow mounting over a non-empty directory. This is not an error at the kernel level, though it can confuse users.
transpetaflops wrote:
3) Mount that partition with "mount -o loop,offset=$((nnn * 512)) /run/Jesus/Jesus /mnt/Jesus". Replace nnn with the start sector from step 2. The "512" is the sector size and should match the output from fdisk in step 1.
Wouldn't it be easier to use losetup with --partscan to make the kernel handle partition management, then use mount on the resulting loop block device?
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum