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



## aurora (Apr 7, 2021)

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

```
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:


```
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@ (Apr 7, 2021)

aurora said:


> 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:
> 
> 
> ```
> ...


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 (Apr 7, 2021)

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

Or `file -s /dev/ad1s1`


----------



## SirDice (Apr 7, 2021)

aurora said:


> 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.


----------



## aurora (Apr 7, 2021)

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:






balanga `gpart show` returns nothing. Here it is and some more output:





`file -s /dev/ad1s1` returns:


```
/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@ (Apr 7, 2021)

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.


----------



## balanga (Apr 7, 2021)

Try `mount` and `camcontrol devlist`


----------



## olli@ (Apr 7, 2021)

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@ (Apr 7, 2021)

balanga said:


> 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 (Apr 7, 2021)

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 ?


----------



## covacat (Apr 7, 2021)

make sure you own the mountpoint if you mount as non root


----------



## aurora (Apr 7, 2021)

olli@ said:


> 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)


----------



## olli@ (Apr 7, 2021)

aurora said:


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


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


----------



## SirDice (Apr 7, 2021)

aurora said:


> again screenshot as it will be messed up by the tabs&spaces in output


Copy/paste that kind of output in [code] bbcodes. That's why we have those. https://forums.freebsd.org/threads/formatting-guidelines.49535/


----------



## balanga (Apr 7, 2021)

`fdisk ad1` 
`fdisk ad2`


----------



## aurora (Apr 7, 2021)

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:


```
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 (Apr 7, 2021)

aurora said:


> 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.


----------



## aurora (Apr 7, 2021)

SirDice said:


> Copy/paste that kind of output in [code] bbcodes. That's why we have those. https://forums.freebsd.org/threads/formatting-guidelines.49535/


For the time being posting the outputs in plain text over `cat > file.txt` is prohibitively difficult because I can't even connect a USB harddrive to the FreeBSD and it's not connected to the local network.


----------



## VladiBG (Apr 7, 2021)

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 (Apr 7, 2021)

VladiBG said:


> 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.



aurora said:


> 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.


aurora said:


> 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@ (Apr 7, 2021)

aurora said:


> 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:
> 
> 
> ```
> ...


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”.


----------



## zirias@ (Apr 7, 2021)

Well, never got an answer here:


Zirias said:


> Did you actually test e.g. FreeBSD 12.2 on that machine?


So I still wonder as well what's the reason to run this ancient piece of software…


----------



## aurora (Apr 7, 2021)

SirDice said:


> 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 (Apr 7, 2021)

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


----------



## aurora (Apr 7, 2021)

olli@ said:


> 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.


----------



## olli@ (Apr 7, 2021)

I’m sorry I have to say this, but beginners that ask for help on this forum should really use a recent version of FreeBSD. Otherwise this is really a huge waste of time.
Please refer to the Thread topics-about-unsupported-freebsd-versions.40469.


----------



## aurora (Apr 7, 2021)

VladiBG said:


> 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
> ...



Well slightly changing the `mount_msdosfs /dev/da0s2 /mnt`

`mount -t msdosfs /dev/da0s1 /mnt/mydisk` has managed to mount that USB harddrive, finally. Phew 

That will enable me to post lengthy  outputs. Now I need to find a way to mount  the ad1 or ad1s1 or ad1s1a or whatever...

And as for the version issue, the question is: did the mount tool change in the newer versions significantly enough to eliminate the type of problem I'm having now? Considering that the mount is a very basic operation and as far as the IDE / PATA harddrives are concerned, I think it has't been changed any considerably. Using a newer version would be therefore a waste of time, actually.


----------



## _martin (Apr 7, 2021)

aurora said:


> did the mount tool change in the newer versions?



While @olli has a point and is absolutely correct you would have the same "issue" running this on current FreeBSD version. Eventhough GPT scheme is now standard you still can have older disk laying around with the old FreeBSD slices. But then you should get familiar with the FreeBSD slices.


----------



## olli@ (Apr 7, 2021)

aurora said:


> And as for the version issue, the question is: did the mount tool change in the newer versions? Because the mount is such a basic operation, I don't think it has been changed. As far as the IDE / PATA harddrives are concerned, I estimate the mount is the same in the most recent version of FreeBSD. Using a newer version would be a waste of time, actually.


Yes, a lot of details have changed, especially for administration of machines. For example, the old ad(4) disk driver doesn’t exist anymore, it has been replaced and is now integrated into the CAM framework, which means that device nodes have different names (things like /dev/ad* don’t exist anymore). This affects mount commands, of course. It also means that you now use camcontrol(8) for IDE / ATA drives (formerly it was only used for SCSI drives). There were a lot of changes to the GEOM framework, too, so now you can consistently use gpart(8) to manage partitions, while the old fdisk(8) and bsdlabel(8) (formerly known as disklabel(8)) are deprecated and don’t work correctly anymore. These are just examples from the top of my head; there is much more.


----------



## zirias@ (Apr 7, 2021)

aurora said:


> Using a newer version would be a waste of time


Given that *a)* you can't ever take that machine online unless you're fine with crackers in control of it and don't care about the harm you cause for _other_ people plus *b)* you'll spend a lot of time figuring out how stuff might have worked in that ancient version …

The real waste of time is trying to operate an EOL system.

That said, operating ancient stuff can make for a nice hobby, if you take precautions, if you know what you're doing. But if your goal is "learn Unix", by all means, use some supported system.


----------



## olli@ (Apr 7, 2021)

aurora said:


> Using a newer version would be a waste of time, actually.


Actually, right now you are wasting a lot of time of a lot of people on this forum. And it’s a waste of time for yourself, too, because learning how to use a 12 years old operating system is rather useless.


----------



## VladiBG (Apr 7, 2021)

aurora said:


> did the mount tool change in the newer versions?


Here is the history for sbin/mount








						History for sbin/mount - freebsd/freebsd-src
					

FreeBSD src tree (read-only mirror). Contribute to freebsd/freebsd-src development by creating an account on GitHub.




					github.com


----------



## SirDice (Apr 7, 2021)

You could dig even deeper if you want: https://github.com/dspinellis/unix-history-repo


----------



## balanga (Apr 7, 2021)

olli@ said:


> Actually, right now you are wasting a lot of time of a lot of people on this forum. And it’s a waste of time for yourself, too, because learning how to use a 12 years old operating system is rather useless.


If anyone feels as if they are wasting their time, they are free to not participate in this thread .

Personally, I'm hoping to install FreeBSD v1 at some point since I have it on CD, but I need to assemble the correct kit to get it installed.


----------

