# Tips for making a bootable disk



## Hakseasp (Jul 18, 2018)

I was locked out of my Asus laptop , and I tried to create a bootable disk to replace a password reset disk to boot Asus laptop ,But I have failed many times and wasted four CDS ,What good ideas can you give me ?


----------



## SirDice (Jul 18, 2018)

What does this have to do with FreeBSD?


----------



## Sebastian (Jul 20, 2018)

You can use mfsBSD . http://mfsbsd.vx.sk


----------



## Chris_H (Jul 20, 2018)

Hakseasp said:


> I was locked out of my Asus laptop , and I tried to create a bootable disk to replace a password reset disk to boot Asus laptop ,But I have failed many times and wasted four CDS ,What good ideas can you give me ?


You can easily boot to the original, or pretty much any recent(ish) FreeBSD install CD/DVD, and boot to single user mode ( option 5 from the boot menu ).
Then, at the prompt. Work your magic.
If you've lost your root password. It's as simple as

```
$ passwd root
Enter new password for root

*****
Please confirm new password

*****
Password for root has been changed.

$ reboot
```
Done.

HTH

--Chris


----------



## Bobi B. (Jul 21, 2018)

I believe that FreeBSD stock install media can be used as a live CD, as well. Boot to live mode, mount(8) existing root filesystem, chroot(8) into it and passwd(1).


----------



## Hakseasp (Jul 23, 2018)

Sebastian said:


> You can use mfsBSD . http://mfsbsd.vx.sk


Thanks for your suggestion ,


----------



## Hakseasp (Jul 23, 2018)

Chris_H said:


> You can easily boot to the original, or pretty much any recent(ish) FreeBSD install CD/DVD, and boot to single user mode ( option 5 from the boot menu ).
> Then, at the prompt. Work your magic.
> If you've lost your root password. It's as simple as
> 
> ...


When it comes to prompts, it's going to be complicated, I guess ,I don't know much about it .


----------



## ShelLuser (Jul 23, 2018)

So assuming we're talking about FreeBSD it really isn't too hard. Though some familiarity with the command line environment is definitely recommended. Still...

Boot using whatever boot media you have. What I usually do is grab a disc1 ISO image and then burn that to CDR, which I then use to boot my stuff. I prefer this method because the installation disk also contains a fairly complete live environment, including manualpages (documentation).

Tell it to start the live cd and then log on as root, you don't need a password.

Next: determine where your original installation is located. You can do this using `sysctl kern.disks` which gives you an overview of all storage media, then you can verify with `gpart show`:

```
peter@zefiris:/home/peter $ sysctl kern.disks
kern.disks: ada2 ada1 ada0 cd1 cd0
peter@zefiris:/home/peter $ gpart show ada0
=>       40  312450656  ada0  GPT  (149G)
         40        256     1  freebsd-boot  (128K)
        296  312450400     2  freebsd-zfs  (149G)
```
Well... that _definitely_ looks like a valid FreeBSD environment to me, including a boot setup.

So... under normal circumstances you have 2 options; you're using ZFS or UFS, and this should be visible when using gpart (you'd be looking at a partition type of freebsd-ufs or the above).

Next step: gaining access to your system. Which can be tricky because there are also many partition schemes, two of the most commonly used being MBR or GPT. The easiest way to determine what we need is using /dev. Above I can see that I want to access the 2nd partition of my ada0 disk. So:

```
peter@zefiris:/home/peter $ ls /dev/ada0*
/dev/ada0       /dev/ada0p1     /dev/ada0p2
```
There's no way around it: I need /dev/ada0p2. If I were using GPT I'd be looking at an entry such as ada0s2. No need to remember all that theory: just peek in /dev to see what you need.

Now... if the filesystem is UFS then things are decently easy: `# mount /dev/ada0p2 /mnt`. This would make your system accessible under /mnt.

So, to clear out your root password the easiest way I can think off is what Bobi B. already suggested: `# chroot /mnt` and then simply run `# passwd`. Simply escape (control-d), umount the system just to be safe using: `# umount /mnt` and then reset.

When working with ZFS things become a bit more tricky. Start by using: `# zpool import` to load the required kernel modules and to see if it lists any ZFS pools. If so use something like this:

`zpool import -fNR /mnt zroot`. This assuming your pool was actually called zroot.

Now check that you can actually access the available filesystems by using: `zfs list`, this should show you all your defined stuff. Assuming you let the installer handle everything you'd be looking for: zroot/default/ROOT. Mount it: `# zfs mount zroot/default/ROOT`, from the top of my head (meaning: I'm 70% certain) this should make the filesystem available under /mnt.

Just verify that /mnt/etc exists, and when it does use the same chroot operation as mentioned earlier.
That should deal with it.


----------



## Chris_H (Jul 24, 2018)

The OP indicated the they were having difficulty accessing the disk. Let alone a users password. If they can't get access to the system. Installing a pkg(8) will be quite impossible. 

--Chris


----------



## SirDice (Jul 24, 2018)

Hakseasp what password are we talking about? BIOS password? Windows? What's the connection with FreeBSD?

Note that this is a FreeBSD support forum, not some generic computer help forum. We cannot and will not support any other operating system besides FreeBSD.


----------



## Hakseasp (Jul 25, 2018)

SirDice said:


> Hakseasp what password are we talking about? BIOS password? Windows? What's the connection with FreeBSD?
> 
> Note that this is a FreeBSD support forum, not some generic computer help forum. We cannot and will not support any other operating system besides FreeBSD.


Thank you for reminding me


----------

