0

I have a CentOS 5 server that is using an external HDD for crontab backups.

The crontab uses several scripts when working with the HDD which is /dev/sdb but the HDD is getting old now and it's time to replace it.

I've inserted the replacement HDD which is now /dev/sdc and it has a partition /dev/sdc1

I tried to format it using

mkfs.ext4 /dev/sdc1

Which worked but now when I plug it into the old HDDs port the scripts don't work because the drive is /dev/sdb1 and not /dev/sdb

Is it possible to format an external HDD to be /dev/sdb instead of /dev/sdb and /dev/sdb1 and what is the recommended linux format

1
  • Your problem is unclear. I think it has to do with the script which you're not showing us or the way you call it. How does it know it's suppose to use /dev/sdb, /dev/sdb1, /dev/sdc, or /dev/sdc1? Aug 25, 2016 at 7:30

1 Answer 1

2

Yes, you do not need a partition, you can format the whole disk, eg in your example make sure /dev/sdc1 is not mounted then do:

mkfs.ext4 /dev/sdc

You may get a warning that there is a partition table. After the format you need to make sure the kernel knows there is no partition, so use

partprobe /dev/sdc

and check that /dev/sdc1 no longer exists. You can now mount /dev/sdc.

6
  • this looks like exactly what I need, I will try it out now Aug 25, 2016 at 8:28
  • on a side note though, I have always used partitions except for this rare case. Are there any drawbacks to not creating a partition? Aug 25, 2016 at 8:37
  • I dont know of anything major. It is harder to give a label to a filesystem than to a partition, for identification. For a usb device it is fairly common not to partition.
    – meuh
    Aug 25, 2016 at 8:44
  • This worked perfectly I can mount the /dev/sdc is it possible to delete the existing /dev/sdc1 partition though? Aug 25, 2016 at 8:49
  • 1
    You should no longer have a /dev/sdc1 device, as the kernel will remove it when it is told to reread the disk partitioning. If it still exists, you should probably unmount sdc, sync, and remove the usb device, then plug it in again. I dont think it matters, but it would be cleaner for sdc1 not to appear.
    – meuh
    Aug 25, 2016 at 8:52

You must log in to answer this question.

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