# Few mounting questions (advice needed)



## Ico (Feb 28, 2009)

Question 1: Look at the mount table below. The last item is my external hdd (Western Digital 1TB). It used to show as 931GB when it was FAT and NTFS. Now that I formatted it as UFS it shows as 902GB and in fact it has 830GB available. Is that normal? Seems like quite a loss.


```
[root@lucy /]# df -h
Filesystem     Size    Used   Avail Capacity  Mounted on
/dev/ad0s1a    496M    242M    215M    53%    /
devfs          1.0K    1.0K      0B   100%    /dev
/dev/ad0s1e    496M     18K    456M     0%    /tmp
/dev/ad0s1f     67G     25G     37G    41%    /usr
/dev/ad0s1d    1.9G    131M    1.6G     7%    /var
/dev/da0s1     902G    4.0M    830G     0%    /mnt/wd
[root@lucy /]# mount
/dev/ad0s1a on / (ufs, local)
devfs on /dev (devfs, local)
/dev/ad0s1e on /tmp (ufs, local, soft-updates)
/dev/ad0s1f on /usr (ufs, local, soft-updates)
/dev/ad0s1d on /var (ufs, local, soft-updates)
/dev/da0s1 on /mnt/wd (ufs, local, soft-updates)
```

Question 2: Thanks to getting the above mentioned usb hdd I have found that in the case of power outage all my data since mounting it gets lost. This is true for UFS (and I think the same happened with FAT and NTFS). Is there a way around it? I read something about synchronous and asynchronous (UFS being async by default?!) and tried mounting the external hdd with: 


```
[root@lucy /]# mount -o noasync /dev/da0s1 /mnt/wd
```

Then ran the "mount" command (see top table) and the same thing showed up - no "synchronous" option on the last line. So question stands, what can I do? How do you guys deal with this? I am sure there has to be a way to not lose your data since the last mount if you use USB disks or anything like that if you have a power outage or unplug the USB by mistake before using "umount".

Furthermore (and this works 100% of the time so far on my FreeBSD 7.0-RELEASE-p5) as I wanted to test the "unplug USB without unmounting loss of data" thing, when I unplug/stop the hdd's power - the WHOLE SERVER CRASHES. Here is the log:


```
Feb 28 17:24:33 lucy kernel: umass0: detached
Feb 28 17:24:48 lucy kernel: umass0: <Western Digital My Book, class 0/0, rev 2.00/1.65, addr 2> on
uhub3
Feb 28 17:24:48 lucy root: Unknown USB device: vendor 0x1058 product 0x1100 bus uhub3
Feb 28 17:24:49 lucy kernel: da1 at umass-sim0 bus 0 target 0 lun 0
Feb 28 17:24:49 lucy kernel: da1: <WD 10EAVS External 1.65> Fixed Direct Access SCSI-4 device
Feb 28 17:24:49 lucy kernel: da1: 40.000MB/s transfers
Feb 28 17:24:49 lucy kernel: da1: 953869MB (1953525168 512 byte sectors: 255H 63S/T 121601C)
Feb 28 17:24:54 lucy kernel: g_vfs_done():da0s1d[WRITE(offset=835898884096, length=2048)]error = 6
Feb 28 17:25:24 lucy kernel: initiate_write_filepage: already started
Feb 28 17:25:24 lucy kernel: g_vfs_done():da0s1d[WRITE(offset=835898884096, length=2048)]error = 6
Feb 28 17:25:55 lucy kernel: initiate_write_filepage: already started
Feb 28 17:25:55 lucy kernel: g_vfs_done():da0s1d[WRITE(offset=835898884096, length=2048)]error = 6
Feb 28 17:26:26 lucy kernel: initiate_write_filepage: already started
Feb 28 17:26:26 lucy kernel: g_vfs_done():da0s1d[WRITE(offset=835898884096, length=2048)]error = 6
Feb 28 17:26:57 lucy kernel: initiate_write_filepage: already started
Feb 28 17:26:57 lucy kernel: g_vfs_done():da0s1d[WRITE(offset=835898884096, length=2048)]error = 6
Feb 28 17:27:28 lucy kernel: initiate_write_filepage: already started
Feb 28 17:27:28 lucy kernel: g_vfs_done():da0s1d[WRITE(offset=835898884096, length=2048)]error = 6
Feb 28 17:27:59 lucy kernel: initiate_write_filepage: already started
Feb 28 17:27:59 lucy kernel: g_vfs_done():da0s1d[WRITE(offset=835898884096, length=2048)]error = 6
Feb 28 17:28:30 lucy kernel: initiate_write_filepage: already started
Feb 28 17:28:30 lucy kernel: g_vfs_done():da0s1d[WRITE(offset=835898884096, length=2048)]error = 6
Feb 28 17:29:01 lucy kernel: initiate_write_filepage: already started
Feb 28 17:29:01 lucy kernel: g_vfs_done():da0s1d[WRITE(offset=835898884096, length=2048)]error = 6
Feb 28 17:29:32 lucy kernel: initiate_write_filepage: already started
Feb 28 17:29:32 lucy kernel: g_vfs_done():da0s1d[WRITE(offset=835898884096, length=2048)]error = 6
Feb 28 17:30:03 lucy kernel: initiate_write_filepage: already started
Feb 28 17:30:03 lucy kernel: g_vfs_done():da0s1d[WRITE(offset=835898884096, length=2048)]error = 6
Feb 28 17:30:34 lucy kernel: initiate_write_filepage: already started
Feb 28 17:30:34 lucy kernel: g_vfs_done():da0s1d[WRITE(offset=835898884096, length=2048)]error = 6
Feb 28 17:31:05 lucy kernel: initiate_write_filepage: already started
Feb 28 17:31:05 lucy kernel: g_vfs_done():da0s1d[WRITE(offset=835898884096, length=2048)]error = 6
Feb 28 17:31:36 lucy kernel: initiate_write_filepage: already started
Feb 28 17:31:36 lucy kernel: g_vfs_done():da0s1d[WRITE(offset=835898884096, length=2048)]error = 6
Feb 28 17:32:07 lucy kernel: initiate_write_filepage: already started
Feb 28 17:32:07 lucy kernel: g_vfs_done():da0s1d[WRITE(offset=835898884096, length=2048)]error = 6
Feb 28 17:32:38 lucy kernel: initiate_write_filepage: already started
Feb 28 17:32:38 lucy kernel: g_vfs_done():da0s1d[WRITE(offset=835898884096, length=2048)]error = 6
Feb 28 17:40:41 lucy syslogd: kernel boot file is /boot/kernel/kernel
Feb 28 17:40:41 lucy kernel: Copyright (c) 1992-2008 The FreeBSD Project.
Feb 28 17:40:41 lucy kernel: Copyright (c) 1979, 1980, 1983, 1986, 1988, 1989, 1991, 1992, 1993, 199
4
Feb 28 17:40:41 lucy kernel: The Regents of the University of California. All rights reserved.
```


----------



## mk (Mar 1, 2009)

check about these 8%


----------



## Ico (Mar 1, 2009)

Thanks, that answered the first question. 

Update on Q2: 

Mounted the drive synchronously:


```
[root@lucy /]# mount -o sync /dev/da0s1 /mnt/wd
[root@lucy /]# mount
/dev/ad0s1a on / (ufs, local)
devfs on /dev (devfs, local)
/dev/ad0s1e on /tmp (ufs, local, soft-updates)
/dev/ad0s1f on /usr (ufs, local, soft-updates)
/dev/ad0s1d on /var (ufs, local, soft-updates)
/dev/da0s1 on /mnt/wd (ufs, local, synchronous, soft-updates)
```

On top of that - the information that was gone after the drive disconnect and system crash, magically appeared on the drive after not being there initially?!?!?! I mean, I rebooted the system, mounted the drive, and "ls" showed just some old folders.. and nothing I had created today. An hour+ later I do an "ls" and today's folders AND files are there?! :q

Tell me this is normal and happens always?


----------



## mk (Mar 1, 2009)

don't get surprise from that 
you write your data as normal but when you pull the plug without to unmount the file system kernel panic since a file system disappeared without a note + some time usb2.0 make system panic. i don't know with current new usb stack how things doing


----------



## Ico (Mar 1, 2009)

So far synchronous is working well, on top of that I added a crontab job just to umount and mount the drive at 6am every day, to be sure everything will be written and saved on the external hdd


----------

