If you ever happen to use a LiveCD to restore or diagnose some computer and you have only the Bootable DVD you can use this method to install additional software that you need in the ram drive. In the following example i will show you how to boot and install sysutils/testdisk midnight-commander misc/mc and sysutils/smartmontools
Depending of the tools that you need to temporary install you can adjust the size of the tmpfs. In following example i'm using 1GB of total memory in VM
1. Boot from FreeBSD-12.1-RELEASE-amd64-bootonly.iso and on the first screen select Live CD and login using root
2. Create in-memory file system where we can install the packages
3. As you need internet access to download them you also need working DNS (resolve.conf) which for the liveCD is stored under /tmp/bsdinstall_etc and for packages to be extracted pkg also use /tmp which by default is only 20M and it's not enough for extraction of PACKAGESITE.txz That's why we first copy the content of the /tmp directory and then increase it's size and restore it's content. This is done only because we need resolve.conf file there and it's easy that way instead of creating directories manually.
4. Configure your network interface in my case using DHCP for interface name "hn0"
5. Install pkg
6. Edit /usr/local/etc/pkg.conf and change PKG_DBDIR and PKG_CACHEDIR
ESC -> leave editor -> save changes
7. Install Midnight Commander
Because /root/ is on read-only fs and mc need to save the configuration under the home directory we need to change the env first or create another tmpfs for the /root/ as we did for /tmp/
Then we can start mc
8. You can install other tools like sysutils/testdisk and sysutils/smartmontools or sysutils/scan_ffs
For Seagate disk translate 48bit raw value for Raw_Read_Error_Rateand Seek_Error_Rate as 16 bits of error count and 32 bit of total count
Run short selft test or long using -t long
Display result
Check TLER,ERC of the disk
Check persistent settings of TLER/ERC (not all disks support it, you may want to use WDTLER for WD or SeaChest_Configure (sctReadTimer, sctWriteTimer for SG)
Set TLER,ERC to 7sec
Case:
you have unbootable FreeBSD and you need to copy some files to remote location or external usb disk.
After you boot from the LiveCD you can mount the partition that hold your /usr and then using scp(1) to copy the files but you will need to copy them one by one. Instead you can start the MC press F9 for drop down menu and make a SFTP link sftp://user@host:22/ and then navigate and copy the files to remote location become much easier.
Depending of the tools that you need to temporary install you can adjust the size of the tmpfs. In following example i'm using 1GB of total memory in VM
1. Boot from FreeBSD-12.1-RELEASE-amd64-bootonly.iso and on the first screen select Live CD and login using root
2. Create in-memory file system where we can install the packages
mount -o size=600M -t tmpfs tmpfs /usr/local/
3. As you need internet access to download them you also need working DNS (resolve.conf) which for the liveCD is stored under /tmp/bsdinstall_etc and for packages to be extracted pkg also use /tmp which by default is only 20M and it's not enough for extraction of PACKAGESITE.txz That's why we first copy the content of the /tmp directory and then increase it's size and restore it's content. This is done only because we need resolve.conf file there and it's easy that way instead of creating directories manually.
cp -R /tmp/ /usr/local/tmp/
mount -o size=200M -t tmpfs tmpfs /tmp/
cp -R /usr/local/tmp/ /tmp/
4. Configure your network interface in my case using DHCP for interface name "hn0"
dhclient hn0
5. Install pkg
pkg bootstrap
6. Edit /usr/local/etc/pkg.conf and change PKG_DBDIR and PKG_CACHEDIR
ee /usr/local/etc/pkg.conf
Code:
PKG_DBDIR = "/usr/local/db/pkg";
PKG_CACHEDIR = "/usr/local/cache/pkg";
ESC -> leave editor -> save changes
7. Install Midnight Commander
pkg install mc
Because /root/ is on read-only fs and mc need to save the configuration under the home directory we need to change the env first or create another tmpfs for the /root/ as we did for /tmp/
setenv MC_PROFILE_ROOT /tmp/
Then we can start mc
rehash
mc
8. You can install other tools like sysutils/testdisk and sysutils/smartmontools or sysutils/scan_ffs
pkg install testdisk
pkg install smartmontools
For Seagate disk translate 48bit raw value for Raw_Read_Error_Rateand Seek_Error_Rate as 16 bits of error count and 32 bit of total count
smartctl -a /dev/ada0 -v 1,raw48:54 -v 7,raw48:54
Run short selft test or long using -t long
smartctl -t short /dev/ada0
Display result
smartctl -l selftest /dev/ada0
Check TLER,ERC of the disk
smartctl -l scterc /dev/ada0
Check persistent settings of TLER/ERC (not all disks support it, you may want to use WDTLER for WD or SeaChest_Configure (sctReadTimer, sctWriteTimer for SG)
smartctl -l scterc,p /dev/ada0
Set TLER,ERC to 7sec
smartctl -l scterc,70,70 /dev/ada0
smartctl -l scterc,70,70,p /dev/ada0
Case:
you have unbootable FreeBSD and you need to copy some files to remote location or external usb disk.
After you boot from the LiveCD you can mount the partition that hold your /usr and then using scp(1) to copy the files but you will need to copy them one by one. Instead you can start the MC press F9 for drop down menu and make a SFTP link sftp://user@host:22/ and then navigate and copy the files to remote location become much easier.
Last edited: