mount /dev/ad1s1 /mnt/mydisk Operation not permitted FreeBSD-7.2

aurora

Well-Known Member

Reaction score: 1
Messages: 250

I'm running FreeBSD-7.2 on the PC whose specs are given at the signature below.

I've connected an IDE harddisk on which FreeBSD-7.4 is installed. I'd like to copy some files from it into the current harddisk

ls /dev
gives
Bash:
ad1
ad1s1
ad1s1a
ad1s1b
ad1s1c
ad1s1d
ad1s1e
ad1s1f
ad1s1fg
ad2
ad2s1
ad2s1a
ad2s1b
ad2s1c
ad2s1d
ad2s1e
ad2s1f
ad2s1g
...
The ones starting with ad2 is the current one (on which FreeBSD-7.2 is installed) because when I mount it it gives the contents of the current one. So I reckon (for the lack of clues) that I need to mount the ad1
when I do mount /dev/ad1s1 /mnt/mydisk (I've created mydisk manually) it gave:

Bash:
mount: /dev/ad1s1: Operation not permitted

On other related posts, it's been recommended to check fstab to see if it contains /dev/ad1s1a, etc. cat fstab lists /dev/ad1s1a, /dev/ad1s1b, etc (I don't know what fstab means, and what it is used for though) so fstab thing is okay. In the same post it's recommended to do fsck -y on the /dev/ad1s1a, etc (estimatedly) to check the harddisk (filesystem) contains no errors. I've did it too and it reported no errors.


How can I mount that harddisk?
 

olli@

Daemon
Developer

Reaction score: 1,205
Messages: 1,108

I'm running FreeBSD-7.2 on the PC whose specs are given at the signature below.
Note that FreeBSD 7.2 is twelve years old and not supported anymore. What’s worse, over the course of these twelve years – like every other operating system – it has collected a huge amount of known security vulnerabilities that are actively exploited by the bad guys around the world. You put yourself and everyone else in danger when you connect this machine to the internet.

Therefore, I strongly recommend to update the PC to a recent version of FreeBSD that is supported and receives security updates.

when I do mount /dev/ad1s1 /mnt/mydisk (I've created mydisk manually) it gave:

Bash:
mount: /dev/ad1s1: Operation not permitted
Historically, old installations of FreeBSD use the so-called “MBR” partitioning scheme where the disk (ad0, ad1, ad2, …) is divided into so-called slices (s1, s2, …), and these slices are in turn subdivided into BSD partitions (a, b, c, d, …). These latter BSD partitions contain the actual file systems.

What you tried to do is to mount the whole slice (ad1s1), but that doesn’t work because it doesn’t contain a file system itself; it only acts as a container for BSD partitions. You have to mount the BSD partitions, for example ad1s1a (this one would probably contain the so-called root file system). Traditionally, the “b” partition (ad1s1b) contains the swap area, so there’s probably no file system, and the “c” partition is an alias for the whole disk, so this one cannot be used either. So, the next usable partition after “a” is probably “d” (typically this is the /var file system, but it might be something else).

On other related posts, it's been recommended to check fstab to see if it contains /dev/ad1s1a, etc. cat fstab lists /dev/ad1s1a, /dev/ad1s1b, etc (I don't know what fstab means, and what it is used for though)
The word “fstab” is short for “file system table”. On most UNIX-based operating systems it is a text file that resides in the /etc directory and lists the file systems to be mounted on this machine. It contains the device (partition), mount point, mount flags, and possibly other information.
 

balanga

Son of Beastie

Reaction score: 184
Messages: 3,644

Not sure if works on 7.2 put have you tried running gpart show ?

Or file -s /dev/ad1s1
 

SirDice

Administrator
Staff member
Administrator
Moderator

Reaction score: 10,683
Messages: 36,456

when I do mount /dev/ad1s1 /mnt/mydisk
You're trying to mount the slice, not the partition. The partitions are ad1s1a, b, d, e, f and g. The c partition is special, don't try to mount that, b is often a swap partition. So only a, d, e, f and g might contain data. Most often /, /var, /tmp and /usr had their own partitions.

Mount it to get some data off of it and nuke it. Don't run FreeBSD 7.x any more. If you have to run 7.x because you have a certain application that can't run on anything else, then I have some bad news for you. We know of one specific application, and when we find out you're running it you're going to get banned immediately.
 
OP
aurora

aurora

Well-Known Member

Reaction score: 1
Messages: 250

olli@ I run FreeBSD mainly to explore Unix administration, to try Unix tools, etc so the security, vulnerability stuff don't matter. But one thing matters really and it's the compatible operation with the hardware and the version 7.2 works perfectly on early 2000's hardware. More on that stuff later. Here's the ls /dev/ in one shot:

20210407-143138-Film1.jpg

balanga gpart show returns nothing. Here it is and some more output:
20210407-143903-Film1.jpg


file -s /dev/ad1s1 returns:

Bash:
/dev/ad1s1: Unix Fast File system [v2] (little endian) last mounted on /, 
last written at Wed Apr 7 16:50:25 2021, clean flag 0, readonly flag 0, number of blocks 
1572864 , number of data blocks 1522503, number of cylinder groups 17, block size 
16384, fragment size 2048, average file size 16384,  average number of files in dir 64, 
pending blocks to free 0, pending inodes to free 0, system-wide uuid 0, min percentage 
of free blocks 8, TIME optimization
 

olli@

Daemon
Developer

Reaction score: 1,205
Messages: 1,108

Are you sure that devfs(5) is mounted on /dev? Please show the output from df. I think devfs(5) became mandatory in FreeBSD 6.0, but I’m not 100 % certain.
 

olli@

Daemon
Developer

Reaction score: 1,205
Messages: 1,108

By the way, I still maintain the recommendation that the machine should be updated to a supported version of FreeBSD. The age of the hardware doesn’t matter much; FreeBSD 12 should still run fine on a Pentium-II with 512 MB RAM (you probably don’t want to enable ZFS, though).

And if you still decide not to fix the OS version (for whatever reason), please do everyone on the internet a favor and run this machine offline only. As soon as it is exposed to the internet, you should assume that it is hacked and starts being used to launch attacks against other targets, spread spam, and so on. There are stories of people who got Tor exit nodes installed on their vulnerable machines without them knowing, getting them into serious trouble.
 

olli@

Daemon
Developer

Reaction score: 1,205
Messages: 1,108

Try mount and camcontrol devlist
This is FreeBSD 7.x with PATA disks, using the ancient ad(4) driver. So camcontrol won’t work. For similar reasons gpart doesn’t work.

aurora : As you can see, that’s another good reason to update: For very old versions you won’t get much help on these forums because many (most?) people don’t know the details anymore of such an ancient version of FreeBSD. Quite a lot has changed in all these years.
 

_martin

Aspiring Daemon

Reaction score: 224
Messages: 982

It almost seems like these two disks were either in mirror or both contain the FreeBSD installation (a being root, b swap, c free space ...). I'd start with the fdisk -p /dev/ad1. Also bsdlabel can read these, so bsdlabel /dev/ad1s1 will give you an idea of the partition layout.
What does syslog say about these errors ?
 
OP
aurora

aurora

Well-Known Member

Reaction score: 1
Messages: 250

Are you sure that devfs(5) is mounted on /dev? Please show the output from df. I think devfs(5) became mandatory in FreeBSD 6.0, but I’m not 100 % certain.
df returns (again screenshot as it will be messed up by the tabs&spaces in output)

df-output.jpg
 

olli@

Daemon
Developer

Reaction score: 1,205
Messages: 1,108

df returns (again screenshot as it will be messed up by the tabs&spaces in output)

df-output.jpg
Well, so the file systems are already mounted. That’s why you cannot mount them elsewhere again (UFS doesn’t allow this).
 
OP
aurora

aurora

Well-Known Member

Reaction score: 1
Messages: 250

Well I've tried for about 30 minutes, to mount a USB harddisk. I've used a ms-dos FAT formatted, laptop-sized 30GB Toshiba IDE harddisk to make it most compatible with the FreeBSD-7.2. After I plug it in, the csh returns:

C:
da0: <TOSHIBA MK3018GAS 0000> Fixed Direct Access SCSI-0 device
GEOM_LABEL: Label for provider da0s2 is msdosfs/TOSHIB30
GEOM_LABEL: Label for provider da0p1 is msdosfs/EFI
da0, da0p1, da0p2, da0s2 are added under /dev

In accordance with the directives at cyberciti.biz - mounting-harddisks-in-freebsd-with-mount-command I've done:
mount /dev/da0 /mnt/mydisk trying with da0p1, da0p2, da0s2, too, all returned: Invalid argument and did not mount the USB harddisk. I can't send other lengthy outputs because the PC is not connected to the local network and I can't even connect the USB harddisk.
 

SirDice

Administrator
Staff member
Administrator
Moderator

Reaction score: 10,683
Messages: 36,456

da0, da0p1, da0p2, da0s2 are added under /dev
That's not possible. It's either ad0p1, p2 etc, for a GPT partitioned disk OR ad0s1, ad0s2 for MBR partitioned disks. It's simply not possible to have both types of partitioning schemes on the same disk.
 

VladiBG

Daemon

Reaction score: 459
Messages: 1,031

You need to specify the filesystem when you mount a USB formated with FAT32
You can do this by using mount_msdosfs or mount -t msdosfs

You CAN'T mount the device itself you can mount only the partition that have a filesystem
Looking at your previous post your "TOSHIBA MK3018GAS" partition is da0s2 with label msdosfs/TOSHIB30 so the mount command will look like
mount_msdosfs /dev/da0s2 /mnt

Don't waste time to learn an older version of FreeBSD 7 as many things has changed it's better to listen to the others advice and install a supported version.
 

eternal_noob

Well-Known Member

Reaction score: 183
Messages: 353

it's better to listen to the others advice and install a supported version.
Yeah. I don't get why he insists of using that ancient version of FreeBSD.

I run FreeBSD mainly to explore Unix administration, to try Unix tools, etc so the security, vulnerability stuff don't matter.
Not a valid reason. You can explore Unix administration with a recent version of FreeBSD too.
one thing matters really and it's the compatible operation with the hardware and the version 7.2 works perfectly on early 2000's hardware.
I run FreeBSD 13.0 on such a machine with 1GB of RAM. Works smoothly. No excuse either.
 

olli@

Daemon
Developer

Reaction score: 1,205
Messages: 1,108

Well I've tried for about 30 minutes, to mount a USB harddisk. I've used a ms-dos FAT formatted, laptop-sized 30GB Toshiba IDE harddisk to make it most compatible with the FreeBSD-7.2. After I plug it in, the csh returns:

C:
da0: <TOSHIBA MK3018GAS 0000> Fixed Direct Access SCSI-0 device
GEOM_LABEL: Label for provider da0s2 is msdosfs/TOSHIB30
GEOM_LABEL: Label for provider da0p1 is msdosfs/EFI
da0, da0p1, da0p2, da0s2 are added under /dev

In accordance with the directives at cyberciti.biz - mounting-harddisks-in-freebsd-with-mount-command I've done:
mount /dev/da0 /mnt/mydisk trying with da0p1, da0p2, da0s2, too, all returned: Invalid argument and did not mount the USB harddisk. I can't send other lengthy outputs because the PC is not connected to the local network and I can't even connect the USB harddisk.
You need to specify the option -t msdosfs or -t msdos (the name was changed at some point in history; I don’t know which one was used by FreeBSD 7.x) to the mount command. By the way, I wouldn’t call FAT “most compatible with FreeBSD”.
 
OP
aurora

aurora

Well-Known Member

Reaction score: 1
Messages: 250

That's not possible. It's either ad0p1, p2 etc, for a GPT partitioned disk OR ad0s1, ad0s2 for MBR partitioned disks. It's simply not possible to have both types of partitioning schemes on the same disk.
Because that harddisk was a leftover from an Apple computer, it had GPT partitioning scheme on it. I've repartitioned it using the macOS Disk Utility to have MBR partitioning and the plain old ms dos FAT formatting. And I've put several mp3 files onto it to easily identify the harddisk on the mount operation. Not it comes up as
/dev/msdosfs
when I mount /dev/msdosfs /mnt/mydisk it returns: mount /dev/msdosfs : Block device required
 

SirDice

Administrator
Staff member
Administrator
Moderator

Reaction score: 10,683
Messages: 36,456

As others have already mentioned, you need to add -t to indicate the filesystem type.
 
OP
aurora

aurora

Well-Known Member

Reaction score: 1
Messages: 250

You need to specify the option -t msdosfs or -t msdos (the name was changed at some point in history; I don’t know which one was used by FreeBSD 7.x) to the mount command. By the way, I wouldn’t call FAT “most compatible with FreeBSD”.
I've tried adding -t msdosfs or -t msdos so that it reads:

mount -t msdosfs /dev/msdosfs /mnt/mydisk

they both returned this time
mount_msdosfs /dev/msdosfs : Block device required


Well if ms dos FAT is not so compatible with FreeBSD, then which one ? Let me know it and use it.
 
Top