# accidentally mount empty dataset on /



## mko_io (Sep 7, 2019)

Hi, 
I just broke my machine with the following comand
`sudo zfs create -o mountpoint=/ pool/scratch`
I thought the mounting point will be /scratch instead of /,  Now I got an empty root file system, any idea How I can rescue my machine

Thanks


----------



## `Orum (Sep 8, 2019)

I think you may have to boot to some other media (e.g. USB, use the memstick installer in "Live CD"/Shell mode), and correct the problem there.  You can import the pool and while doing so, tell it to either not mount the filesystems, or to use an alternate root (or both).  Then simply change the mountpoint, and boot back to your original install.

Also, this would be better posted in the 'storage' section.


----------



## mko_io (Sep 11, 2019)

`Orum said:


> I think you may have to boot to some other media (e.g. USB, use the memstick installer in "Live CD"/Shell mode), and correct the problem there.  You can import the pool and while doing so, tell it to either not mount the filesystems, or to use an alternate root (or both).  Then simply change the mountpoint, and boot back to your original install.
> 
> Also, this would be better posted in the 'storage' section.



Thanks for reply, I know how to boot into a live CD but I don't know how to import the zpool without auto-mounting, Could you give me more detail of how to do that?


----------



## SirDice (Sep 11, 2019)

mko_io said:


> but I don't know how to import the zpool without auto-mounting


The easiest is to import with the `-R` option set.


```
-R root
                 Sets the "cachefile" property to "none" and the "altroot"
                 property to "root"
```
Ignore the 'cachefile' for now, it's the 'altroot' we're after.

```
altroot
         Alternate root directory. If set, this directory is prepended to any
         mount points within the pool. This can be used when examining an
         unknown pool where the mount points cannot be trusted, or in an
         alternate boot environment, where the typical paths are not valid.
         altroot is not a persistent property. It is valid only while the
         system is up.  Setting altroot defaults to using cachefile=none,
         though this may be overridden using an explicit setting.
```

Import the pool with altroot set to /tmp/zroot/ or something similar. Once it's imported you can change the mountpoint of the offending dataset to something more sensible.


----------



## mko_io (Sep 12, 2019)

Problem solved, that's exactly what am I looking for, Thanks for explanation.


----------

