![raspberry pi disk formatting raspberry pi disk formatting](https://raspberrytips.com/wp-content/uploads/2018/12/uuid.jpg)
Personally I prefer this way because this give me the option to easily switch back to use SD card as the root file system with a simple modification of /boot/cmdline.txt file. The Raspberry Pi is still using /boot for booting but use the hard disk as Raspberry Pi's file system. To verify the configuraton after reboot, run: Add rootdelay=5 at the end of the command.ĭwc_otg.lpm_enable=0 console=serial0,115200 console=tty1 root=/dev/sda1 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait rootdelay=5 Change the root=/dev/mmcblk0p2 or root=PARTUUID=xxxxxxxx-02 to /dev/sda1 Step 7 - Confugure hard disk as Raspberry Pi's root file systemĮdit /boot/cmdline.txt using nano editor to configure the hard disk as Rapsberry Pi's root / file system: Notice that we still keep SD card as the /boot directory, and our new hard disk is mounted as Raspberry Pi's root directory /. # a swapfile is not a swap partition, no line here #PARTUUID=xxxxxxxx-02 / ext4 defaults,noatime 0 1 PARTUUID=xxxxxxxx-01 /boot vfat defaults 0 2 Save the file and verify the changes with cat /etc/fstab, it should looks like this: PARTUUID=xxxxxxxx-02 / ext4 defaults,noatime 0 1Īnd add this line below the line that you just commented out: Step 6 - Add the configuration to /etc/fstab This command basically transfer all the files in current root file system to the newly mounted hard disk. Now we can copying the files to the hard disk which is mounted at /mnt.
RASPBERRY PI DISK FORMATTING INSTALL
If rsync is not installed in your Raspberry Pi yet, run the install command. In order to copy the content of my current SD card to the new hard disk, we need to install a utility called rsync, rsync not only copy all the files from a source to destination, it will ensure all file permissions and ownership are intact when copy over to the new hard disk. This will create a directory named /mnt and mount the hard disk /dev/sda1 as the /mnt. Step 4 - Create a directory for mounting the harddisk Writing superblocks and filesystem accounting information: done Run sudo fdisk -l to see the newly created partition.ĭevice Boot Start End Sectors Size Id Type Press "w" to write the partition to the disk (this cannot be undone), and then press "Enter". Type "83" for "Linux" followed by "Enter" Press "t" to change the file system type followed by "Enter" This will make the partition cover the entire disk rather than just part of it Enter the default for both the first and last cylinders when your computer asks for this information. Press "1" and "Enter" to create the first partition
![raspberry pi disk formatting raspberry pi disk formatting](https://hackaday.com/wp-content/uploads/2016/11/rigol-pi-blogview-wb.jpg)
Press "p" and "Enter" to create a primary partition Press "n" to make the new partition, and then press "Enter" Now we can create a new partition by running command: sudo fdisk /dev/sda Run the following command to erase the old partition: dev/sda2 409640 976510983 976101344 465.5G Apple HFS/HFS+įist, We need to erase the original partition and create a new partition. Sector size (logical/physical): 512 bytes / 512 bytes
![raspberry pi disk formatting raspberry pi disk formatting](https://www.engineersgarage.com/wp-content/uploads/2019/07/How-to-install-raspberry-pi3.jpg)
If you have a new harddisk, you can skip this step and go to step 2:ĭisk /dev/sda: 465.8 GiB, 500107859968 bytes, 976773164 sectors If you are using the original power adapter from Raspberry Pi like me, it is sufficient to power the 2.5 inch hard disk with extra external power supply.Ī quick check of the hard disk with fdisk command shows that it has two partitions with Apple HFS file system so it need to be re-format to Linux file system. The additional hardware that I need is one of those USB to SATA adapter that can be found easily at local computer shop or online. The hard disk that I have for this build is a 500GB Samsung hard disk that was previously used on my MacBook Pro. I have a couple of old hard disks with me, so I recently decided to replace the SD card of this web site's Raspberry Pi with a hard disk. For past 3 years this web site was running on a Raspberry Pi with a 16GB SD card.