# FreeBSD shutdown question and more...



## milfeulle (Mar 18, 2015)

Hi, I have two questions. It's a little shame that my English is not good.
Here are the questions.

1. My FreeBSD 10.1 machine mounts Windows 7 NTFS file system every boot by fstab.
    But after some NTFS partition works, I insert command `reboot` without unmounting, then every works done at NTFS partition vanish. (sysutils/fusefs-ntfs from ports, synchronous, rw option)

    Usually I don't forget "unmount NTFS partition task" but sometimes not, then I get nervous.
    How do I let My FreeBSD system automatically unmount NTFS partition after I input `reboot` or `shutdown` command carelessly ?
    Handbook has no contents about this as far as I know 

2. At CLI, some commands takes a lot of time for carrying out, so I don't know when the process finishes. (For example, `make buildworld` or `rsync` very big bytes)
    So I wanna play some music by mpg321 after some process finishes. && works not pretty well at this situation.

    Is there more decent way than `<command> && mpg321 <some songs>` method?

    Thanks in advance for reading this question.


----------



## junovitch@ (Mar 18, 2015)

Hello,
1. I'm not 100% about the NTFS part here, but perhaps this will help.  This is a little FreeBSD nuance with the reboot(8) command.


> Normally, the shutdown(8) utility is used when the system needs to be
> halted or restarted, giving users advance warning of their impending doom
> and cleanly terminating specific programs.



Basically `reboot` just has the init(8) process terminate everything while shutdown(8) calls /etc/rc.shutdown which asks this to shut down gracefully.  Generally use `shutdown -r now` to reboot and `shutdown -p now` to power off.

I'm not sure if that little bit of info helps in the case.  Honestly it's a bit surprising with the synchronous option and doesn't seem like it should be happening.

2. Is playing audio after the task finishes mainly so that you know you can interactively use the shell again?  If so, this isn't an exact answer for that, but your best bet may be to install sysutils/tmux and use that so you can do things flexibly in another window while the original tasks finishes.  You can also detach from a task that you have started to return later.


----------



## milfeulle (Mar 19, 2015)

Thanks junovitch. But `shutdown -r` doesn't works as I mentioned earlier. For reference, my fstab is

```
/dev/ada1s2            /mnt/c_drive        ntfs-3g           rw,failok,mountprog=/usr/local/bin/ntfs-3g           0            0
/dev/ada1s3            /mnt/d_drive        ntfs-3g           rw,failok,mountprog=/usr/local/bin/ntfs-3g           0            0
```
In response to my mount command, csh says "synchronous" definitely. In fact, just now before writing this reply, again I forgot to"unmount work", so my rsync backup data headed for NTFS partition vanished.
So I decide that I will attach a post-it written "DON'T FORGET UNMOUNT" at my notebook. 

Again, thank you for your recommendation of the sysutils/tmux port, I'll try it from now on


----------



## SirDice (Mar 19, 2015)

Do these partitions have to be NTFS? Or could you change them to UFS? The reason being that NTFS support is something that's reverse engineered and may not be 100% compatible.


----------



## kpa (Mar 19, 2015)

I'd guess this is yet another problem with the FUSE implementation in FreeBSD. I have yet to see it working properly on any system I've tried to use it on.


----------



## junovitch@ (Mar 19, 2015)

milfeulle said:


> Thanks junovitch. But `shutdown -r` doesn't works as I mentioned earlier. For reference, my fstab is



Ok, I wasn't 100% sure if you were referring to 'shutdown' the word or shutdown(8) the command.  An option might be to add a safety net to automatically unmount when the system shuts down cleanly.  This won't help in the unclean shutdown case if the the files weren't completely synced to disk.

Consider adding the unmounting into the location below at the bottom of /etc/rc.shutdown.

```
# Insert other shutdown procedures here


echo '.'
exit 0
```

With that said, this is cleaner that a post it note to remind you to unmount the drive but it's still a workaround the FUSE or sysutils/fusefs-ntfs issue.


----------



## milfeulle (Mar 20, 2015)

SirDice said:


> Do these partitions have to be NTFS? Or could you change them to UFS? The reason being that NTFS support is something that's reverse engineered and may not be 100% compatible.


In fact, I must have Windows OS installed for work, though it sucks.  But personally FreeBSD is best to me, so I try one thing or another  to my notebook.
I have to be more careful about NTFS writing.

Thanks SirDice, and kpa, too.


----------



## milfeulle (Mar 20, 2015)

junovitch said:


> Ok, I wasn't 100% sure if you were referring to 'shutdown' the word or shutdown(8) the command.  An option might be to add a safety net to automatically unmount when the system shuts down cleanly.  This won't help in the unclean shutdown case if the the files weren't completely synced to disk.
> 
> Consider adding the unmounting into the location below at the bottom of /etc/rc.shutdown.
> 
> ...


Maybe, I think this is the solution for my need. Thanks.


----------



## TiberiusDuval (Mar 23, 2015)

Hmm I don't use "pure" FreeBSD, instead of it use PC-BSD, but it has same kind of problem some files I copy to NTFS disks do not seem to properly copy. I found some nice way to make sure that such files are truly written down on NTFS disks. Run as root command `sync` before shutting down your FreeBSD system and at least on my system files are truly copied, even Windows sees them.


----------



## ANOKNUSA (Mar 23, 2015)

If nothing else, you could mount the NTFS partitions as read-only and use a USB stick or SD card formated to FAT32 to move files from FreeBSD to Windows. I'm always wary of sharing files on non-native filesystems myself, with the exception of FAT, as it's been available on every OS forever and is practically a _de facto_ computing standard at this point.


----------

