Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I created a directory on the dev with the command mkdir /dev/hddbackup on CentOs powered server. After rebooting the server the directory is gone. I use the command ls to see it but it's not there. How do I make it stick?

share|improve this question

closed as off-topic by Iain, kasperd, Ward, Jenny D, HopelessN00b Sep 2 '14 at 2:37

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions must demonstrate a minimal understanding of the problem being solved. Try including attempted solutions, why they didn't work, and the expected results. See How can I ask better questions on Server Fault? for further guidance." – Iain, kasperd, Ward, Jenny D, HopelessN00b
If this question can be reworded to fit the rules in the help center, please edit the question.

Creating directory is not the solution as /dev stand for special devices and files which needs to be created using "MAKEDEV or mknod" . Once you create a device using makedev or mknod then it will be available after reboot too. Hope that helps. – Pratap Aug 30 '14 at 7:38
That's very helpful. Thank you. – Soheil Mirzaei Aug 30 '14 at 7:40

You might find that your /dev tree is managed by udev, which means it is not persistent.

You can test this by looking at the output of "mount":

   steve@ssh ~ $ mount | grep /dev
   udev on /dev type devtmpfs (rw,relatime,size=10240k,nr_inodes=191404,mode=755)

In that example you can see "devtmpfs", meaning the device-tree is stored in RAM and will disappear (and be recreated dynamically) on reboot.

Your best bet would be to add a cron-job, startup-script, or similar to create the missing entry.

Failing that add it in the start of your existing backup-script, where it will be used.

share|improve this answer
Instead of creating the directory each reboot, fix the main problem : don't put your backup directories in /dev. – user186340 Aug 30 '14 at 7:48
Where should we make the directory then? – Soheil Mirzaei Aug 30 '14 at 7:51
I personally use /mnt/backups, /srv/backup is also good. "It depends" is the short answer. – Steve Kemp Aug 30 '14 at 7:55
@SteveKemp I'd avoid using /mnt though, since it's for mount points rather than actual files - even though I've never seen this, I don't see why a distro can't have /mnt in tmpfs since there's no actual data on it. @SoheilMirzaei /backups will be just fine. – user186340 Aug 30 '14 at 11:37

Not the answer you're looking for? Browse other questions tagged or ask your own question.