简体   繁体   English

debian wheezy-如何挂载未使用的磁盘?

[英]debian wheezy - how to mount unused disks?

I'm mostly a database guy but i have debian wheezy server with 4 hard disks. 我主要是数据库专家,但是我有带4个硬盘的Debian Wheezy服务器。 It was set up using one disk a while back, that one was all that was needed. 它是使用一段时间后的一个磁盘设置的,仅此而已。 Now, i need more space and the thing, i think, that is throwing me off is the UUID disk stuff. 现在,我需要更多空间,我认为让我失望的是UUID磁盘。

anyway: 无论如何:

/mnt# lsblk -io KNAME,TYPE,SIZE,MODEL
KNAME TYPE   SIZE MODEL
sdb   disk 232.9G Hitachi HDP72502
sdc   disk 232.9G Hitachi HDP72502
sda   disk 232.9G Hitachi HDP72502
sda1  part 223.4G
sda2  part     1K
sda5  part   9.5G
sdd   disk 232.9G Hitachi HDP72502
sr0   rom   1024M DVD A  DS8A1P

Root is mounted to sda. 根已安装到sda。 sdb, c and d are unused, unformatted etc. i just need some more space, so i have created /mnt/ext_b/ and so on for b, c, d. sdb,c和d未使用,未格式化等。我只需要更多空间,所以我为b,c,d创建了/ mnt / ext_b /,依此类推。

mount shows: 坐骑表演:

/dev/disk/by-uuid/1b1e97e4-3c04-4e50-8e06-b16752778717 on / type ext4 (rw,relatime,errors=remount-ro,user_xattr,barrier=1,data=ordered) / dev / disk / by-uuid / 1b1e97e4-3c04-4e50-8e06-b16752778717 on / type ext4(rw,relatime,errors = remount-ro,user_xattr,barrier = 1,data = ordered)

which is correct. 哪个是对的。 i want to mount the others just for space, how do i get their UUIDs? 我只想为其他空间安装空间,如何获取其UUID?

/mnt# blkid
/dev/sda5: UUID="f70ad0b2-a9d0-430a-829c-d2e37245fd71" TYPE="swap"
/dev/sda1: UUID="1b1e97e4-3c04-4e50-8e06-b16752778717" TYPE="ext4"

how do i get the UUIDs to put formatted filesystems on the disks? 我如何获取UUID将格式化的文件系统放在磁盘上?

/mnt# mkfs.ext4 /dev/sdb1
mke2fs 1.42.5 (29-Jul-2012)
Could not stat /dev/sdb1 --- No such file or directory

thanks in advance. 提前致谢。

matt 亚光

It seems that those additional disks haven't been touched since they were connected to the server and don't have even partitions yet. 自从它们连接到服务器以来,甚至还没有分区,这些附加磁盘似乎没有被触摸过。 In general, adding extra disk space in Linux can be done in the following steps: 通常,可以通过以下步骤在Linux中添加额外的磁盘空间:

  1. Attach new disk to the server 将新磁盘连接到服务器
  2. Create partition table on it 在上面创建分区表
  3. Add one or more partitions to the disk 向磁盘添加一个或多个分区
  4. Format partition to the FS of your choice 将分区格式化为您选择的FS
  5. Mounting this partition to the mount point of your choice 将此分区挂载到您选择的挂载点
  6. Make those mount persistent by adding appropriate line to the /etc/fstab 通过在/etc/fstab添加适当的行来使那些挂载持久

If you have multiple disks you may consider to create hardware RAID disk if you have RAID controller or software RAID, using mdadm tool . 如果有多个磁盘,则如果您具有RAID控制器或软件RAID,则可以考虑使用mdadm工具创建硬件RAID磁盘。 Both ways you'll get larger single disk(size would depend from the RAID level you choose) for which you'll need to go to step 2 and farther. 两种方式都将获得更大的单个磁盘(大小将取决于您选择的RAID级别),您需要将其转到步骤2甚至更远。 It's worth mentioning that there is another way to get larger than single disk usable space from multiple disks called Logical Volume Manager or LVM . 值得一提的是,还有另一种从多个磁盘获取大于单个磁盘可用空间的方法,称为Logical Volume Manager或LVM It's more sophisticated than MDM and allows to create FS snapshots and add extra disk space to the volume without need to create additional mountpoints. 它比MDM更复杂,并且可以创建FS快照并向卷中添加额外的磁盘空间,而无需创建其他安装点。

Whatever you choose you'll need to create a partition table on a new disk/LVM volume/MDM disk. 无论选择什么,都需要在新磁盘/ LVM卷/ MDM磁盘上创建分区表。 Here you need to make another choice - what type of partition table to use, MBR or GPT . 在这里,您需要做出另一种选择-使用哪种类型的分区表MBRGPT Check Partitioning HOWTO for more details, but in general I'd recommend GPT for large non-bootable disks. 有关更多详细信息,请参见“ 分区指南” ,但一般而言,对于大型不可引导磁盘,我建议使用GPT。

Same HOWTO will tell you, how create partition(s) on the selected disk. 同样的方法将告诉您如何在所选磁盘上创建分区。 At this point you'll get devices like /dev/sdb1 , etc. 此时,您将获得/dev/sdb1等设备。

Then you can go to step 4, the one you already tried: 然后,您可以转到步骤4,即您已经尝试过的步骤:

# mkfs.ext4 /dev/sdb1

That should succeed now and you'll be able to get UUID of a new FS with blkid . 现在应该可以成功了,您将可以使用blkid获取新FS的UUID。 Add obtained UUID to your /etc/fstab file and mount newly created FS to it's mount point. 将获得的UUID添加到您的/etc/fstab文件中,并将新创建的FS挂载到其挂载点。

It seems to me that you must create partitions on disks. 在我看来,您必须在磁盘上创建分区。 Think about storing your data. 考虑存储数据。 You have similar disks. 您有类似的磁盘。 It must be raid? 一定要突袭吗? If it must be raid, what type of raid it must be? 如果必须进行突袭,则必须是哪种突袭?

You can create partition with fdisk or some alternatives ( gparted , cfdisk and so on). 您可以使用fdisk或某些替代方案( gpartedcfdisk等)创建分区。 There are a lot information in internet and manuals. 互联网和手册中有很多信息。

May be you need LVM? 可能您需要LVM? Some people say that it may slow down your database, but it gives you opportunity to get snapshots. 有人说这可能会降低数据库的速度,但是却为您提供了获取快照的机会。

After creating partitions you can create filesystem and can mount it. 创建分区后,您可以创建文件系统并可以挂载它。 Usually people recommend to use XFS or Ext4 for databases. 通常,人们建议对数据库使用XFS或Ext4。

And don't forget to set right mount flags to your filestystem. 并且不要忘记为您的filetystem设置正确的挂载标志。 noatime , nodiratime and barrier=0 will improve performance, but with barrier=0 in some cases you can loose your data. noatimenodiratimebarrier=0可以提高性能,但是在某些情况下使用barrier=0可以使数据丢失。 In case of Ext4 look at data (may be in your case you can set it in ordered ). 在的ext4看的情况下, data (可能是你的情况,你可以将其设置在ordered )。

UPD: may be this question must be in superuser or unix section? UPD:可能这个问题必须在超级用户或Unix部分中吗?

您应该先使用fdisk,cfdi​​sk,gparted或partitionmanager等实用程序创建分区 ,然后再对其进行格式化。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM