2

About a year ago, I installed Windows 7 on an old laptop to use it as a file server. The laptop itself has a pretty puny hard disk, so I hooked up two 500GB external drives.

After only a few days I noticed that with every reboot, all my shares on the USB media simply disappeared. I therefore applied a fix–presumably a registry tweak, forgot exactly what–that seemed to resolve the issue by simply delaying the start of the Windows File and Printer Sharing service.

That works great, most of the time, but sometimes all my shares (about eight of them) still vanish, forcing me to spend a good ten minutes on setting them up again.

So here's my two part question:

  • Does anyone know how to resolve the problem?
  • Is there some way I can backup specifically the shares settings, to simply restore them–either when the get lost, or on every boot?
1
  • I just remembered what I did to make it work at least most of the time. Under Services I set the Server service to Automatic (Delayed Start).
    – oKtosiTe
    Dec 1, 2010 at 16:34

4 Answers 4

2

You can automate the fix so that the shares are applied whenever the drive is (re)detected:

When you plug in a USB drive, windows logs the event 7036, Service Control Manager, Portable Device Enumerator Service. Use event viewer to attach a task to the event (right-click on event) that runs net share (as in other post) or a batch file containing net share statements.

This windows 'bug' has been bugging me for some time. With the help on this site I was able to fix it (well, limited testing seems positive so far).

Thanks.

1

I'm guessing that the configuration of the shares isn't particularly complex (maybe just sharing out to public or whoever, and you are probably sharing out the root of each USB drive).

My first suggestion would be that you write a powershell script or a even just a batch file using "net share" that could quickly recreate the shares from scratch when you needed to.

My second suggestion, would be to create a folder on our C drive, share just that folder and use junction points to redirect to the other drives:

c:\mount c:\mount\usb01 c:\mount\usb02 c:\mount\usb03 c:\mount\usb04 ... c:\mount\usb08

Usb01 through 08 point to your various USB drives.

Share the c:\mount folder as "mount", or whatever, and there you are. If one of the USB drives is offline for whatever reason and someone tries to access it, they'll just get some sort of error, or maybe they just won't see any files. I think. I've never tried this with USB drives, but it works with SATA drives. If it does work, you won't need that registry hack you metioned; the file service could start up when it is supposed to because it won't be trying to share something it can't see (yet).

1
  • Sorry, but you are guessing wrong. I have public, user specific and administrative shares. The option to script still stands of course, but doing so would possibly require more time than I'll ever be able so sink into this during the lifetime of the server. The junction point option may in fact be useful, since the number of shares is larger than the number of users. I can only assume the junction points will survive a reboot. Thanks for the suggestions in any case!
    – oKtosiTe
    Dec 1, 2010 at 16:18
1

It's not a be all end all solution to my problem, but the shares can be backed up by following the procedure on this Microsoft KnowledgeBase article.

A simple reboot restored my shares settings without any additional action taken, which luckily is good enough for me, since all the devices/people that need access to the shares have the capacity to restart the server.

Better solutions still welcome of course.

1

Same issue here. My business experience: Never use share permissions, always use file permissions. File permissions will stick after reboot.
Add simple startup cmd file like this example:

net share public=z:\public /GRANT:everyone,FULL

net share cd_images=z:\cd_images /GRANT:everyone,FULL

net share videos=z:\public\videos /GRANT:everyone,FULL

net share music=z:\public\music /GRANT:everyone,FULL

This is also handy for keeping a record of all your shares. For many shares, you could use a for loop. These commands will be ignored if somehow the shares stick after reboot.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .