I’m been think about how to backup Samba to a USB thumb drive since I posted Backup/Recovery for Samba and I found a way.

Step 1:

Place the thumb drive in minimal CentOS and does this step.  ‘-io’ allows for a listing of all the labels you put in lsblk.  Note: If you already made a ext4 partition on the thumb drive skip the first three steps and go to the step 4.

lsblk -io kname,type,size,model

Step 2:

Find the drive for USB and does this step. My thumb drive is sdb. I think it makes it Linux partition on the thumb drive but I can’t find out for sure.

echo '0,' | sfdisk /dev/sdb

Step 3:

Next step is make a ext4 partition on the whole thumb drive and I made mine ‘backups’ for it’s name.

mke2fs -T ext4 /dev/sdb1 -L backups

Step 4:

Then make a mount point for the USB thumb drive.

mkdir -p /mnt/usb

Step 5:

The last step is too add line at the end in your /etc/fstab file.

/dev/sdb1 /mnt/usb ext4 defaults 0 0


or another Step 4 and Step 5:

If you want to make sure that the only USB thumb drive is mounted, do this step first:

lsblk -f

NAME        FSTYPE   LABEL     UUID                                   MOUNTPOINT
├─sda1      xfs                ed4f40b7-c65c-431a-ad2e-e5efb7b92410   /boot
└─sda2      LVM2_mem           M3uGgj-ff3Y-dguK-BpUI-26kx-L5M8-8ecccy 
  ├─cl-root xfs                c4d4ad4c-cfe9-4288-bb22-fcb45eaa4a4c   /
  └─cl-swap swap               9d68498d-0708-4a2e-a752-7c2346d6ab0c   [SWAP]
└─sdb1      ext4     backups   93bafca2-1522-4fe1-9837-f8685e390309   /mnt/usb
sr0         iso9660  CentOS 7 x86_64

Then using the UUID characters, highlighted in bold for the thumb drive, add this line instead to to the /etc/fstab.

UUID=93bafca2-1522-4fe1-9837-f8685e390309 /mnt/usb ext4 defaults 0 0

Then restart CentOS and your thumb drive should be auto-mounted as /mnt/usb.

If you want to remove the thumb drive while CentOS is on, do this step:

umount /mnt/usb





Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s